当前位置: 首页>>代码示例>>PHP>>正文


PHP qa_user_level_string函数代码示例

本文整理汇总了PHP中qa_user_level_string函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_user_level_string函数的具体用法?PHP qa_user_level_string怎么用?PHP qa_user_level_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了qa_user_level_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_role_marker

 function get_role_marker($uid, $switch)
 {
     if (QA_FINAL_EXTERNAL_USERS) {
         $user = get_userdata($uid);
         if (isset($user->wp_capabilities['administrator']) || isset($user->caps['administrator']) || isset($user->allcaps['administrator'])) {
             $level = qa_lang('users/level_admin');
             $img = 'admin';
         } elseif (isset($user->wp_capabilities['moderator']) || isset($user->caps['moderator'])) {
             $level = qa_lang('users/level_moderator');
             $img = 'moderator';
         } elseif (isset($user->wp_capabilities['editor']) || isset($user->caps['editor'])) {
             $level = qa_lang('users/level_editor');
             $img = 'editor';
         } elseif (isset($user->wp_capabilities['contributor']) || isset($user->caps['contributor'])) {
             $level = qa_lang('users/level_expert');
             $img = 'expert';
         } else {
             return;
         }
     } else {
         $levelno = qa_db_read_one_value(qa_db_query_sub('SELECT level FROM ^users WHERE userid=#', $uid), true);
         $level = qa_user_level_string($levelno);
         if ($level == qa_lang('users/level_admin') || $level == qa_lang('users/level_super')) {
             $img = 'admin';
         } elseif ($level == qa_lang('users/level_moderator')) {
             $img = 'moderator';
         } elseif ($level == qa_lang('users/level_editor')) {
             $img = 'editor';
         } elseif ($level == qa_lang('users/level_expert')) {
             $img = 'expert';
         } else {
             return;
         }
     }
     if ($switch == 1) {
         return '<div class="qa-avatar-marker"><img title="' . qa_html($level) . '" width="20" src="' . QA_HTML_THEME_LAYER_URLTOROOT . $img . '.png"/></div>';
     } else {
         return '<span class="qa-who-marker qa-who-marker-' . $img . '" title="' . qa_html($level) . '">' . qa_opt('marker_plugin_who_text') . '</span>';
     }
 }
开发者ID:ruuttt,项目名称:question2answer_sandbox,代码行数:40,代码来源:qa-marker-layer.php

示例2: qa_db_user_set_password

        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');
开发者ID:netham91,项目名称:question2answer,代码行数:31,代码来源:qa-page-account.php

示例3: array

         $label .= ':';
     }
     $qa_content['form_profile']['fields'][$userfield['title']] = array('type' => $fieldsediting ? 'text' : 'static', 'label' => qa_html($label), 'tags' => 'NAME="field_' . $userfield['fieldid'] . '"', 'value' => $valuehtml, 'error' => qa_html(@$errors[$userfield['fieldid']]), 'rows' => $userfield['flags'] & QA_FIELD_FLAGS_MULTI_LINE ? 8 : null);
 }
 //	Edit form or button, if appropriate
 if ($usereditbutton) {
     if ($userediting) {
         if (qa_opt('avatar_allow_gravatar') && $useraccount['flags'] & QA_USER_FLAGS_SHOW_GRAVATAR || qa_opt('avatar_allow_upload') && $useraccount['flags'] & QA_USER_FLAGS_SHOW_AVATAR && isset($useraccount['avatarblobid'])) {
             $qa_content['form_profile']['fields']['removeavatar'] = array('type' => 'checkbox', 'label' => qa_lang_html('users/remove_avatar'), 'tags' => 'NAME="removeavatar"');
         }
         if (isset($maxlevelassign)) {
             $qa_content['form_profile']['fields']['level']['type'] = 'select';
             $leveloptions = array(QA_USER_LEVEL_BASIC, QA_USER_LEVEL_EXPERT, QA_USER_LEVEL_EDITOR, QA_USER_LEVEL_MODERATOR, QA_USER_LEVEL_ADMIN, QA_USER_LEVEL_SUPER);
             foreach ($leveloptions as $leveloption) {
                 if ($leveloption <= $maxlevelassign) {
                     $qa_content['form_profile']['fields']['level']['options'][$leveloption] = qa_html(qa_user_level_string($leveloption));
                 }
             }
         }
         $qa_content['form_profile']['buttons'] = array('save' => array('tags' => 'onClick="qa_show_waiting_after(this, false);"', 'label' => qa_lang_html('users/save_user')), 'cancel' => array('tags' => 'NAME="docancel"', 'label' => qa_lang_html('main/cancel_button')));
         $qa_content['form_profile']['hidden'] = array('dosave' => '1');
     } else {
         $qa_content['form_profile']['buttons'] = array('edit' => array('tags' => 'NAME="doedit"', 'label' => qa_lang_html('users/edit_user_button')));
         if (isset($maxlevelassign) && $useraccount['level'] < QA_USER_LEVEL_MODERATOR) {
             if ($useraccount['flags'] & QA_USER_FLAGS_USER_BLOCKED) {
                 $qa_content['form_profile']['buttons']['unblock'] = array('tags' => 'NAME="dounblock"', 'label' => qa_lang_html('users/unblock_user_button'));
                 if (count($questions) && !qa_user_permit_error('permit_hide_show')) {
                     $qa_content['form_profile']['buttons']['hideall'] = array('tags' => 'NAME="dohideall" onClick="qa_show_waiting_after(this, false);"', 'label' => qa_lang_html('users/hide_all_user_button'));
                 }
                 if ($loginlevel >= QA_USER_LEVEL_ADMIN) {
                     $qa_content['form_profile']['buttons']['delete'] = array('tags' => 'NAME="dodelete" onClick="qa_show_waiting_after(this, false);"', 'label' => qa_lang_html('users/delete_user_button'));
开发者ID:ruuttt,项目名称:question2answer,代码行数:31,代码来源:qa-page-user.php

示例4: cs_ajax_user_popover

function cs_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 = cs_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 {
            $data = cs_user_data($handle);
        }
        ?>
		<div id="<?php 
        echo $userid;
        ?>
_popover" class="user-popover">
			<div class="counts clearfix">
				<div class="points">
					<?php 
        echo '<span>' . $data['points'] . '</span>Points';
        ?>
				</div>
				<div class="qcount">
					<?php 
        echo '<span>' . $data['qposts'] . '</span>Questions';
        ?>
				</div>
				<div class="acount">
					<?php 
        echo '<span>' . $data['aposts'] . '</span>Answers';
        ?>
				</div>
				<div class="ccount">
					<?php 
        echo '<span>' . $data['cposts'] . '</span>Comments';
        ?>
				</div>
			</div>
			<div class="bottom">	
				<div class="avatar pull-left"><?php 
        echo cs_get_avatar($handle, 30);
        ?>
</div>
				<span class="name"><?php 
        echo cs_name($handle);
        ?>
</span>				
				<span class="level"><?php 
        echo qa_user_level_string($data['level']);
        ?>
</span>				
			</div>
		</div>	
		<?php 
    }
    die;
}
开发者ID:microbye,项目名称:CleanStrap,代码行数:61,代码来源:functions.php

示例5: qa_set_up_category_field

                     } else {
                         $fieldnavcategories = $navcategories;
                     }
                     qa_set_up_category_field($qa_content, $qa_content['form_profile']['fields']['uc_' . $index . '_cat'], 'uc_' . $index . '_cat', $fieldnavcategories, @$userlevel['entityid'], true, true);
                     unset($qa_content['form_profile']['fields']['uc_' . $index . '_cat']['note']);
                 }
             }
             $qa_content['script_lines'][] = array("function qa_update_category_levels()", "{", "\tglob=document.getElementById('level_select');", "\tif (!glob)", "\t\treturn;", "\tvar opts=glob.options;", "\tvar lev=parseInt(opts[glob.selectedIndex].value);", "\tfor (var i=1; i<9999; i++) {", "\t\tvar sel=document.getElementById('ls_'+i);", "\t\tif (!sel)", "\t\t\tbreak;", "\t\tsel.qa_prev=sel.qa_prev || sel.options[sel.selectedIndex].value;", "\t\tsel.options.length=1;", "\t\tfor (var j=0; j<opts.length; j++)", "\t\t\tif (parseInt(opts[j].value)>lev)", "\t\t\t\tsel.options[sel.options.length]=new Option(opts[j].text, opts[j].value, false, (opts[j].value==sel.qa_prev));", "\t}", "}");
             $qa_content['script_onloads'][] = array("qa_update_category_levels();");
             $qa_content['form_profile']['fields']['level']['tags'] .= ' id="level_select" onchange="qa_update_category_levels();"';
         }
     }
 } else {
     foreach ($userlevels as $userlevel) {
         if ($userlevel['entitytype'] == QA_ENTITY_CATEGORY && $userlevel['level'] > $useraccount['level']) {
             $qa_content['form_profile']['fields']['level']['value'] .= '<br/>' . strtr(qa_lang_html('users/level_for_category'), array('^1' => qa_html(qa_user_level_string($userlevel['level'])), '^2' => '<a href="' . qa_path_html(implode('/', array_reverse(explode('/', $userlevel['backpath'])))) . '">' . qa_html($userlevel['title']) . '</a>'));
         }
     }
 }
 //	Show any extra privileges due to user's level or their points
 $showpermits = array();
 $permitoptions = qa_get_permit_options();
 foreach ($permitoptions as $permitoption) {
     if (qa_permit_error($permitoption, $userid, QA_USER_LEVEL_APPROVED, QA_USER_FLAGS_EMAIL_CONFIRMED, 0) && !qa_permit_error($permitoption, $userid, $useraccount['level'], $useraccount['flags'], $userpoints['points'])) {
         if ($permitoption == 'permit_retag_cat') {
             $showpermits[] = qa_lang(qa_using_categories() ? 'profile/permit_recat' : 'profile/permit_retag');
         } else {
             $showpermits[] = qa_lang('profile/' . $permitoption);
         }
         // then show it as an extra priviliege
     }
开发者ID:gogupe,项目名称:question2answer-releases,代码行数:31,代码来源:qa-page-user-profile.php

示例6: qa_other_to_q_html_fields


//.........这里部分代码省略.........
            }
            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;
}
开发者ID:amiyasahu,项目名称:question2answer,代码行数:101,代码来源:format.php

示例7: qa_fatal_error

    exit;
}
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-app-users.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
//	Check we're not using single-sign on integration
if (QA_FINAL_EXTERNAL_USERS) {
    qa_fatal_error('User accounts are handled by external code');
}
//	Get list of special users
$users = qa_db_select_with_pending(qa_db_users_from_level_selectspec(QA_USER_LEVEL_EXPERT));
//	Check we have permission to view this page (moderator or above)
if (qa_get_logged_in_level() < QA_USER_LEVEL_MODERATOR) {
    $qa_content = qa_content_prepare();
    $qa_content['error'] = qa_lang_html('users/no_permission');
    return $qa_content;
}
//	Get userids and handles of retrieved users
$usershtml = qa_userids_handles_html($users);
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('users/special_users');
$qa_content['ranking'] = array('items' => array(), 'rows' => ceil(qa_opt('page_size_users') / qa_opt('columns_users')), 'type' => 'users');
foreach ($users as $user) {
    $qa_content['ranking']['items'][] = array('label' => $usershtml[$user['userid']], 'score' => qa_html(qa_user_level_string($user['level'])));
}
$qa_content['navigation']['sub'] = qa_users_sub_navigation();
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
开发者ID:netham91,项目名称:question2answer,代码行数:31,代码来源:qa-page-users-special.php

示例8: qa_lang

        $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 {
开发者ID:ruuttt,项目名称:question2answer_sandbox,代码行数:31,代码来源:qa-page-account.php

示例9: cs_user_nav

    function cs_user_nav($handle)
    {
        $user = cs_user_data($handle);
        $this->output('			
			<div class="user-header">
				<div class="user-header-inner clearfix">
			  <div class="user-thumb">
				' . cs_get_avatar($handle, 150) . '
			  </div>
			  <div class="user-name-detail">
				<h3>' . cs_name($handle) . '<small class="block m-t-mini">' . qa_user_level_string($user['level']) . '</small>
				</h3>
				
				');
        $this->output('</div>');
        $this->cs_user_profile_button($handle);
        $this->nav('sub');
        $this->favorite();
        $this->output('</div>');
        $this->output('</div>');
    }
开发者ID:microbye,项目名称:CleanStrap,代码行数:21,代码来源:blocks.php

示例10: get_full_post

 function get_full_post($post, $options, $usershtml)
 {
     $fields['raw'] = $post;
     $userid = qa_get_logged_in_userid();
     $cookieid = qa_cookie_get();
     $fields['netvotes_raw'] = (int) $post['netvotes'];
     $postid = $post['postid'];
     $isquestion = $post['basetype'] == 'Q';
     $isanswer = $post['basetype'] == 'A';
     $isbyuser = @$post['userid'] == $userid;
     $anchor = urlencode(qa_anchor($post['basetype'], $postid));
     $elementid = isset($options['elementid']) ? $options['elementid'] : $anchor;
     $microformats = false;
     $isselected = @$options['isselected'];
     // content
     if (@$options['contentview'] && !empty($post['content'])) {
         $viewer = qa_load_viewer($post['content'], $post['format']);
         $fields['content'] = $viewer->get_html($post['content'], $post['format'], array('blockwordspreg' => @$options['blockwordspreg'], 'showurllinks' => @$options['showurllinks'], 'linksnewwindow' => @$options['linksnewwindow']));
     }
     if ($post['hidden']) {
         $fields['vote_state'] = 'disabled';
     } elseif ($isbyuser) {
         $fields['vote_state'] = 'disabled';
     } elseif (@$post['uservote'] > 0) {
         $fields['vote_state'] = 'voted_up';
     } elseif (@$post['uservote'] < 0) {
         $fields['vote_state'] = 'voted_down';
     } else {
         if (strpos($options['voteview'], '-uponly-level')) {
             $fields['vote_state'] = 'up_only';
         } else {
             $fields['vote_state'] = 'enabled';
         }
     }
     //	Created when and by whom
     $fields['meta_order'] = qa_lang_html('main/meta_order');
     // sets ordering of meta elements which can be language-specific
     if (@$options['whatview']) {
         $fields['what'] = qa_lang_html($isquestion ? 'main/asked' : ($isanswer ? 'main/answered' : 'main/commented'));
         if (@$options['whatlink'] && !$isquestion) {
             $fields['what_url'] = qa_path_html(qa_request(), array('show' => $postid), null, null, qa_anchor($post['basetype'], $postid));
         }
     }
     if (isset($post['created']) && @$options['whenview']) {
         $fields['when'] = qa_when_to_html($post['created'], @$options['fulldatedays']);
     }
     if (@$options['whoview']) {
         $fields['who'] = qa_who_to_html($isbyuser, @$post['userid'], $usershtml, @$options['ipview'] ? @$post['createip'] : null, $microformats);
         if (isset($post['points'])) {
             if (@$options['pointsview']) {
                 $fields['who']['points'] = $post['points'] == 1 ? qa_lang_html_sub_split('main/1_point', '1', '1') : qa_lang_html_sub_split('main/x_points', qa_html(number_format($post['points'])));
             }
             if (isset($options['pointstitle'])) {
                 $fields['who']['title'] = qa_get_points_title_html($post['points'], $options['pointstitle']);
             }
         }
         if (isset($post['level'])) {
             $fields['who']['level'] = qa_html(qa_user_level_string($post['level']));
         }
     }
     $isselected = @$options['isselected'];
     //	Updated when and by whom
     if (isset($post['opostid'])) {
         // updated meta
         switch ($post['obasetype'] . '-' . @$post['oupdatetype']) {
             case 'Q-':
                 $langstring = 'main/asked';
                 break;
             case 'Q-' . QA_UPDATE_VISIBLE:
                 $langstring = $post['hidden'] ? 'main/hidden' : 'main/reshown';
                 break;
             case 'Q-' . QA_UPDATE_CLOSED:
                 $langstring = isset($post['closedbyid']) ? 'main/closed' : 'main/reopened';
                 break;
             case 'Q-' . QA_UPDATE_TAGS:
                 $langstring = 'main/retagged';
                 break;
             case 'Q-' . QA_UPDATE_CATEGORY:
                 $langstring = 'main/recategorized';
                 break;
             case 'A-':
                 $langstring = 'main/answered';
                 break;
             case 'A-' . QA_UPDATE_SELECTED:
                 $langstring = 'main/answer_selected';
                 break;
             case 'A-' . QA_UPDATE_VISIBLE:
                 $langstring = $post['ohidden'] ? 'main/hidden' : 'main/answer_reshown';
                 break;
             case 'A-' . QA_UPDATE_CONTENT:
                 $langstring = 'main/answer_edited';
                 break;
             case 'Q-' . QA_UPDATE_FOLLOWS:
                 $langstring = 'main/asked_related_q';
                 break;
             case 'C-':
                 $langstring = 'main/commented';
                 break;
             case 'C-' . QA_UPDATE_TYPE:
                 $langstring = 'main/comment_moved';
//.........这里部分代码省略.........
开发者ID:doekia,项目名称:q2a-xml-rpc,代码行数:101,代码来源:qa-xml-rpc-server.php

示例11: ranking

    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);
        }
    }
开发者ID:microbye,项目名称:Donut,代码行数:98,代码来源:qa-donut-layer.php

示例12: foreach

        $this->content['ra_profile'][$k] = $c;
    }
}
foreach ($p as $k => $c) {
    if ($k == 'duration' || $k == 'lastlogin' || $k == 'lastwrite') {
        $this->content['ra_visit'][$k] = $c;
    }
}
?>
<div class="profile-fields clearfix">
	<div class="profile-avatar pull-left">
		<?php 
echo $p['avatar']['html'];
?>
		<h3><?php 
echo $this->content['raw']['account']['handle'] . '<span>' . qa_html(qa_user_level_string($this->content['raw']['account']['level']));
?>
</span></h3>
		<div class="points icon-radio-checked"><?php 
echo $user[0]['points'];
?>
</div>
		<div class="badges"><?php 
echo ra_user_badge($handle);
?>
</div>
		
	</div>
	<div class="user-info">
		<div class="profile-buttons">
			<?php 
开发者ID:rahularyan,项目名称:dude-theme,代码行数:31,代码来源:profile.php

示例13: qa_other_to_q_html_fields

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;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:45,代码来源:qa-app-format.php

示例14: 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) {
//.........这里部分代码省略.........
开发者ID:architbakliwal,项目名称:RapidInnovation,代码行数:101,代码来源:qa-donut-layer.php

示例15: activitylist


//.........这里部分代码省略.........
                        }
                        $vote_status .= '<span>' . $event['params']['favorite'] . ' favourites</span>';
                    }
                    $output .= '<div class="event-icon pull-left icon-chat"></div>
								<div class="event-content">
									<p class="title">
										<span class="what">your question received new votes: ' . $vote_status . '</span>
									</p>
									<a class="title" href="' . $url . '">' . $event['params']['qtitle'] . '</a>
									<span class="date"> ' . $event['date'] . '</span>
								</div>';
                    break;
                case 'in_a_vote':
                    // 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']), null, qa_opt('site_url'), null, $anchor);
                    if ($event['params']['a_vote_up']) {
                        $vote_status = '<span>' . $event['params']['a_vote_up'] . ' upvotes</span>';
                    }
                    if ($event['params']['a_vote_down']) {
                        if (isset($vote_status)) {
                            $vote_status .= ' - ';
                        }
                        $vote_status .= '<span>' . $event['params']['a_vote_down'] . ' downvotes</span>';
                    }
                    $output .= '<div class="event-icon pull-left icon-chat"></div>
								<div class="event-content">
									<p class="title">
										<span class="what">your answer received new votes: ' . $vote_status . '</span>
									</p>
									<a class="title" href="' . $url . '">' . $event['params']['qtitle'] . '</a>
									<span class="date"> ' . $event['date'] . '</span>
								</div>';
                    break;
                case 'q_approve':
                    $anchor = qa_anchor('Q', $event['postid']);
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), null, qa_opt('site_url'), null, $anchor);
                    $output .= '<div class="event-icon pull-left icon-chat"></div>
								<div class="event-content">
									<p class="title">
									<span class="what">your question was approved</span>
									</p>
									<a class="title" href="' . $url . '">' . $event['params']['qtitle'] . '</a>
									<span class="date"> ' . $event['date'] . '</span>
								</div>';
                    break;
                case 'a_approve':
                    $anchor = qa_anchor('A', $event['postid']);
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), null, qa_opt('site_url'), null, $anchor);
                    $output .= '<div class="event-icon pull-left icon-chat"></div>
								<div class="event-content">
									<p class="title">
									<span class="what">your answer was approved</span>
									</p>
									<a class="title" href="' . $url . '">' . $event['params']['qtitle'] . '</a>
									<span class="date"> ' . $event['date'] . '</span>
								</div>';
                    break;
                case 'c_approve':
                    $anchor = qa_anchor('C', $event['postid']);
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), null, qa_opt('site_url'), null, $anchor);
                    $output .= '<div class="event-icon pull-left icon-chat"></div>
								<div class="event-content">
									<p class="title">
									<span class="what">your comment was approved</span>
									</p>
									<a class="title" href="' . $url . '">' . $event['params']['qtitle'] . '</a>
									<span class="date"> ' . $event['date'] . '</span>
								</div>';
                    break;
                case 'q_reject':
                    $anchor = qa_anchor('C', $event['postid']);
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), null, qa_opt('site_url'), null, $anchor);
                    $output .= '<div class="event-icon pull-left icon-chat"></div>
								<div class="event-content">
									<p class="title">
									<span class="what">your question was rejected</span>
									</p>
									<span class="title">' . $event['params']['qtitle'] . '</span>
									<span class="date"> ' . $event['date'] . '</span>
								</div>';
                    break;
                case 'a_reject':
                case 'c_reject':
                    break;
                case 'u_level':
                    $output .= '<div class="event-icon pull-left icon-chat"></div>
								<div class="event-content">
									<p class="title">
										<span class="what">You level had been changed from' . qa_html(qa_user_level_string($event['params']['oldlevel'])) . ' to ' . qa_html(qa_user_level_string($event['params']['level'])) . '</span>
									</p>
								</div>';
                    break;
                case 'a_post':
                    break;
            }
        }
        $output .= '</li>';
        return $output;
    }
开发者ID:swuit,项目名称:swuit-q2a,代码行数:101,代码来源:qa-layer-ajax.php


注:本文中的qa_user_level_string函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。