示例#1
0
function qa_get_user_avatar_html($flags, $email, $handle, $blobid, $width, $height, $size, $padding = false)
{
    if (qa_opt('avatar_allow_gravatar') && $flags & QA_USER_FLAGS_SHOW_GRAVATAR) {
        $html = qa_get_gravatar_html($email, $size);
    } elseif (qa_opt('avatar_allow_upload') && $flags & QA_USER_FLAGS_SHOW_AVATAR) {
        if (isset($blobid)) {
            $html = qa_get_avatar_blob_html($blobid, $width, $height, $size, $padding);
        } elseif (strlen($handle)) {
            $userprofile = qa_db_select_with_pending(qa_db_user_profile_selectspec($handle, false));
            if (!empty($userprofile['social_avatar'])) {
                $html = '<img src="' . $userprofile['social_avatar'] . '" width="' . $size . '" height="' . $size . '" class="qa-avatar-image" />';
            } else {
                $html = null;
            }
        }
    }
    if (!isset($html)) {
        if ((qa_opt('avatar_allow_gravatar') || qa_opt('avatar_allow_upload')) && qa_opt('avatar_default_show') && strlen(qa_opt('avatar_default_blobid'))) {
            $html = qa_get_avatar_blob_html(qa_opt('avatar_default_blobid'), qa_opt('avatar_default_width'), qa_opt('avatar_default_height'), $size, $padding);
        } else {
            $html = null;
        }
    }
    return isset($html) && strlen($handle) ? '<A HREF="' . qa_path_html('user/' . $handle) . '" CLASS="qa-avatar-link">' . $html . '</A>' : $html;
}
示例#2
0
 function qa_get_user_avatar_html($flags, $email, $handle, $blobid, $width, $height, $size, $padding = false)
 {
     if (qa_to_override(__FUNCTION__)) {
         $args = func_get_args();
         return qa_call_override(__FUNCTION__, $args);
     }
     require_once QA_INCLUDE_DIR . 'app/format.php';
     if (qa_opt('avatar_allow_gravatar') && $flags & QA_USER_FLAGS_SHOW_GRAVATAR) {
         $html = qa_get_gravatar_html($email, $size);
     } elseif (qa_opt('avatar_allow_upload') && $flags & QA_USER_FLAGS_SHOW_AVATAR && isset($blobid)) {
         $html = qa_get_avatar_blob_html($blobid, $width, $height, $size, $padding);
     } elseif ((qa_opt('avatar_allow_gravatar') || qa_opt('avatar_allow_upload')) && qa_opt('avatar_default_show') && strlen(qa_opt('avatar_default_blobid'))) {
         $html = qa_get_avatar_blob_html(qa_opt('avatar_default_blobid'), qa_opt('avatar_default_width'), qa_opt('avatar_default_height'), $size, $padding);
     } else {
         $html = null;
     }
     return isset($html) && strlen($handle) ? '<a href="' . qa_path_html('user/' . $handle) . '" class="qa-avatar-link">' . $html . '</a>' : $html;
 }
    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 {
        $avataroptions[''] = qa_lang_html('users/avatar_none');
    }
    $avatarvalue = $avataroptions[''];
    if (qa_opt('avatar_allow_gravatar')) {
        $avataroptions['gravatar'] = '<span style="margin:2px 0; display:inline-block;">' . qa_get_gravatar_html($useraccount['email'], 32) . ' ' . strtr(qa_lang_html('users/avatar_gravatar'), array('^1' => '<a href="http://www.gravatar.com/" target="_blank">', '^2' => '</a>')) . '</span>';
        if ($useraccount['flags'] & QA_USER_FLAGS_SHOW_GRAVATAR) {
            $avatarvalue = $avataroptions['gravatar'];
        }
    }
    if (qa_has_gd_image() && qa_opt('avatar_allow_upload')) {
        $avataroptions['uploaded'] = '<input name="file" type="file">';
        if (isset($useraccount['avatarblobid'])) {
            $avataroptions['uploaded'] = '<span style="margin:2px 0; display:inline-block;">' . qa_get_avatar_blob_html($useraccount['avatarblobid'], $useraccount['avatarwidth'], $useraccount['avatarheight'], 32) . '</span>' . $avataroptions['uploaded'];
        }
        if ($useraccount['flags'] & QA_USER_FLAGS_SHOW_AVATAR) {
            $avatarvalue = $avataroptions['uploaded'];
        }
    }
    $qa_content['form_profile']['fields']['avatar'] = array('type' => 'select-radio', 'label' => qa_lang_html('users/avatar_label'), 'tags' => 'name="avatar"', 'options' => $avataroptions, 'value' => $avatarvalue, 'error' => qa_html(@$errors['avatar']));
} else {
    unset($qa_content['form_profile']['fields']['avatar']);
}
//	Other profile fields
foreach ($userfields as $userfield) {
    $value = @$inprofile[$userfield['fieldid']];
    if (!isset($value)) {
        $value = @$userprofile[$userfield['title']];
    }
示例#4
0
function cs_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_gravatar') || qa_opt('avatar_allow_upload')) && qa_opt('avatar_default_show') && strlen(qa_opt('avatar_default_blobid'))) {
                    $html = qa_get_avatar_blob_html(qa_opt('avatar_default_blobid'), qa_opt('avatar_default_width'), qa_opt('avatar_default_height'), $size, 0);
                } else {
                    $img_html = '';
                }
            } else {
                $f = cs_user_data($handle);
                if (empty($f['avatarblobid'])) {
                    if (qa_opt('avatar_allow_gravatar')) {
                        $img_html = qa_get_gravatar_html(qa_get_user_email($userid), $size);
                    } elseif ((qa_opt('avatar_allow_gravatar') || qa_opt('avatar_allow_upload')) && qa_opt('avatar_default_show') && strlen(qa_opt('avatar_default_blobid'))) {
                        $img_html = qa_get_avatar_blob_html(qa_opt('avatar_default_blobid'), qa_opt('avatar_default_width'), qa_opt('avatar_default_height'), $size, 0);
                    } else {
                        $img_html = '';
                    }
                } else {
                    $img_html = qa_get_user_avatar_html($f['flags'], $f['email'], $handle, $f['avatarblobid'], $size, $size, $size, true);
                }
            }
        }
    }
    if (empty($img_html)) {
        return;
    }
    preg_match('@src="([^"]+)"@', $img_html, $match);
    if ($html) {
        return '<a href="' . qa_path_html('user/' . $handle) . '">' . (!defined('QA_WORDPRESS_INTEGRATE_PATH') ? '<img src="' . $match[1] . '" />' : $img_html) . '</a>';
    } elseif (isset($match[1])) {
        return $match[1];
    }
}
         $optionfield['error'] = qa_lang_html('admin/no_image_gd');
     }
     break;
 case 'avatar_store_size':
 case 'avatar_profile_size':
 case 'avatar_users_size':
 case 'avatar_q_page_q_size':
 case 'avatar_q_page_a_size':
 case 'avatar_q_page_c_size':
 case 'avatar_q_list_size':
 case 'avatar_message_list_size':
     $optionfield['note'] = qa_lang_html('admin/pixels');
     break;
 case 'avatar_default_show':
     $qa_content['form']['tags'] .= 'enctype="multipart/form-data"';
     $optionfield['label'] .= ' <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> <input name="avatar_default_file" type="file" style="width:16em;">';
     break;
 case 'logo_width':
 case 'logo_height':
     $optionfield['suffix'] = qa_lang_html('admin/pixels');
     break;
 case 'pages_prev_next':
     qa_optionfield_make_select($optionfield, array(0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5), $value, 3);
     break;
 case 'columns_tags':
 case 'columns_users':
     qa_optionfield_make_select($optionfield, array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5), $value, 2);
     break;
 case 'min_len_q_title':
 case 'q_urls_title_length':
 case 'min_len_q_content':
示例#6
0
         $optionfield['style'] = 'tall';
         $optionfield['error'] = qa_lang_html('admin/no_image_gd');
     }
     break;
 case 'avatar_store_size':
 case 'avatar_profile_size':
 case 'avatar_users_size':
 case 'avatar_q_page_q_size':
 case 'avatar_q_page_a_size':
 case 'avatar_q_page_c_size':
 case 'avatar_q_list_size':
     $optionfield['note'] = qa_lang_html('admin/pixels');
     break;
 case 'avatar_default_show':
     $qa_content['form']['tags'] .= 'ENCTYPE="multipart/form-data"';
     $optionfield['label'] .= ' <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> <INPUT NAME="avatar_default_file" TYPE="file" STYLE="width:16em;">';
     break;
 case 'logo_width':
 case 'logo_height':
     $optionfield['suffix'] = qa_lang_html('admin/pixels');
     break;
 case 'pages_prev_next':
     qa_optionfield_make_select($optionfield, array(0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5), $value, 3);
     break;
 case 'columns_tags':
 case 'columns_users':
     qa_optionfield_make_select($optionfield, array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5), $value, 2);
     break;
 case 'min_len_q_title':
 case 'q_urls_title_length':
 case 'min_len_q_content':
示例#7
0
 function qa_get_user_avatar_html($flags, $email, $handle, $blobid, $width, $height, $size, $padding = false)
 {
     require_once QA_INCLUDE_DIR . 'qa-app-format.php';
     if (qa_opt('avatar_allow_gravatar') && $flags & QA_USER_FLAGS_SHOW_GRAVATAR) {
         $html = qa_get_gravatar_html($email, $size);
     } elseif (qa_opt('avatar_allow_upload') && $flags & QA_USER_FLAGS_SHOW_AVATAR && isset($blobid)) {
         $html = qa_get_avatar_blob_html($blobid, $width, $height, $size, $padding);
     } elseif ((qa_opt('avatar_allow_gravatar') || qa_opt('avatar_allow_upload')) && qa_opt('avatar_default_show') && strlen(qa_opt('avatar_default_blobid'))) {
         $html = qa_get_avatar_blob_html(qa_opt('avatar_default_blobid'), qa_opt('avatar_default_width'), qa_opt('avatar_default_height'), $size, $padding);
     } else {
         $html = null;
     }
     return isset($html) && strlen($handle) ? '<A HREF="' . qa_path_html('user/' . $handle) . '" CLASS="qa-avatar-link">' . $html . '</A>' : $html;
 }