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


PHP avatar_remote函数代码示例

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


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

示例1: main


//.........这里部分代码省略.........
                    ${'s_sort_' . $sort_option . '_key'} = '<select name="' . $sort_option . '_sk">';
                    foreach (${'sort_by_' . $sort_option . '_text'} as $key => $text) {
                        $selected = ${$sort_option . '_sk'} == $key ? ' selected="selected"' : '';
                        ${'s_sort_' . $sort_option . '_key'} .= '<option value="' . $key . '"' . $selected . '>' . $text . '</option>';
                    }
                    ${'s_sort_' . $sort_option . '_key'} .= '</select>';
                    ${'s_sort_' . $sort_option . '_dir'} = '<select name="' . $sort_option . '_sd">';
                    foreach ($sort_dir_text as $key => $value) {
                        $selected = ${$sort_option . '_sd'} == $key ? ' selected="selected"' : '';
                        ${'s_sort_' . $sort_option . '_dir'} .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
                    }
                    ${'s_sort_' . $sort_option . '_dir'} .= '</select>';
                }
                $template->assign_vars(array('S_PREFS' => true, 'S_JABBER_DISABLED' => $config['jab_enable'] && $user->data['user_jabber'] && @extension_loaded('xml') ? false : true, 'VIEW_EMAIL' => isset($data['viewemail']) ? $data['viewemail'] : $user_row['user_allow_viewemail'], 'MASS_EMAIL' => isset($data['massemail']) ? $data['massemail'] : $user_row['user_allow_massemail'], 'ALLOW_PM' => isset($data['allowpm']) ? $data['allowpm'] : $user_row['user_allow_pm'], 'HIDE_ONLINE' => isset($data['hideonline']) ? $data['hideonline'] : !$user_row['user_allow_viewonline'], 'NOTIFY_EMAIL' => $notify_method == NOTIFY_EMAIL ? true : false, 'NOTIFY_IM' => $notify_method == NOTIFY_IM ? true : false, 'NOTIFY_BOTH' => $notify_method == NOTIFY_BOTH ? true : false, 'NOTIFY_PM' => isset($data['notifypm']) ? $data['notifypm'] : $user_row['user_notify_pm'], 'POPUP_PM' => isset($data['popuppm']) ? $data['popuppm'] : $this->optionget($user_row, 'popuppm'), 'DST' => isset($data['dst']) ? $data['dst'] : $user_row['user_dst'], 'BBCODE' => isset($data['bbcode']) ? $data['bbcode'] : $this->optionget($user_row, 'bbcode'), 'SMILIES' => isset($data['smilies']) ? $data['smilies'] : $this->optionget($user_row, 'smilies'), 'ATTACH_SIG' => isset($data['sig']) ? $data['sig'] : $this->optionget($user_row, 'attachsig'), 'NOTIFY' => isset($data['notify']) ? $data['notify'] : $user_row['user_notify'], 'VIEW_IMAGES' => isset($data['view_images']) ? $data['view_images'] : $this->optionget($user_row, 'viewimg'), 'VIEW_FLASH' => isset($data['view_flash']) ? $data['view_flash'] : $this->optionget($user_row, 'viewflash'), 'VIEW_SMILIES' => isset($data['view_smilies']) ? $data['view_smilies'] : $this->optionget($user_row, 'viewsmilies'), 'VIEW_SIGS' => isset($data['view_sigs']) ? $data['view_sigs'] : $this->optionget($user_row, 'viewsigs'), 'VIEW_AVATARS' => isset($data['view_avatars']) ? $data['view_avatars'] : $this->optionget($user_row, 'viewavatars'), 'VIEW_WORDCENSOR' => isset($data['view_wordcensor']) ? $data['view_wordcensor'] : $this->optionget($user_row, 'viewcensors'), 'S_TOPIC_SORT_DAYS' => $s_limit_topic_days, 'S_TOPIC_SORT_KEY' => $s_sort_topic_key, 'S_TOPIC_SORT_DIR' => $s_sort_topic_dir, 'S_POST_SORT_DAYS' => $s_limit_post_days, 'S_POST_SORT_KEY' => $s_sort_post_key, 'S_POST_SORT_DIR' => $s_sort_post_dir, 'DATE_FORMAT' => $dateformat, 'S_DATEFORMAT_OPTIONS' => $dateformat_options, 'S_CUSTOM_DATEFORMAT' => $s_custom, 'DEFAULT_DATEFORMAT' => $config['default_dateformat'], 'A_DEFAULT_DATEFORMAT' => addslashes($config['default_dateformat']), 'S_LANG_OPTIONS' => language_select($lang), 'S_STYLE_OPTIONS' => style_select($style), 'S_TZ_OPTIONS' => tz_select($tz)));
                break;
            case 'avatar':
                $avatar_select = basename(request_var('avatar_select', ''));
                $category = basename(request_var('category', ''));
                $can_upload = file_exists($phpbb_root_path . $config['avatar_path']) && is_writeable($phpbb_root_path . $config['avatar_path']) && $file_uploads ? true : false;
                $data = array();
                if ($submit) {
                    $delete = request_var('delete', '');
                    $var_ary = array('uploadurl' => (string) '', 'remotelink' => (string) '', 'width' => (string) '', 'height' => (string) '');
                    foreach ($var_ary as $var => $default) {
                        $data[$var] = request_var($var, $default);
                    }
                    $var_ary = array('uploadurl' => array('string', true, 5, 255), 'remotelink' => array('string', true, 5, 255), 'width' => array('string', true, 1, 3), 'height' => array('string', true, 1, 3));
                    $error = validate_data($data, $var_ary);
                    if (!sizeof($error)) {
                        $data['user_id'] = $user_id;
                        if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload && $config['allow_avatar_upload']) {
                            list($type, $filename, $width, $height) = avatar_upload($data, $error);
                        } else {
                            if ($data['remotelink'] && $config['allow_avatar_remote']) {
                                list($type, $filename, $width, $height) = avatar_remote($data, $error);
                            } else {
                                if ($avatar_select && $config['allow_avatar_local']) {
                                    $type = AVATAR_GALLERY;
                                    $filename = $avatar_select;
                                    // check avatar gallery
                                    if (!is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category)) {
                                        $type = $width = $height = 0;
                                        $filename = '';
                                    } else {
                                        list($width, $height) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $filename);
                                        $filename = $category . '/' . $filename;
                                    }
                                } else {
                                    if ($delete) {
                                        $filename = '';
                                        $type = $width = $height = 0;
                                    } else {
                                        $data = array();
                                    }
                                }
                            }
                        }
                    }
                    if (!sizeof($error)) {
                        // Do we actually have any data to update?
                        if (sizeof($data)) {
                            $sql_ary = array('user_avatar' => $filename, 'user_avatar_type' => $type, 'user_avatar_width' => $width, 'user_avatar_height' => $height);
                            $sql = 'UPDATE ' . USERS_TABLE . '
								SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
								WHERE user_id = ' . $user_id;
                            $db->sql_query($sql);
开发者ID:yunsite,项目名称:gloryroad,代码行数:67,代码来源:acp_users.php

示例2: main


//.........这里部分代码省略.........
                            trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
                        }
                        $file_uploads = @ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on' ? true : false;
                        $user->add_lang(array('acp/groups', 'acp/common'));
                        $data = $submit_ary = array();
                        $update = isset($_POST['update']) ? true : false;
                        $error = array();
                        $avatar_select = basename(request_var('avatar_select', ''));
                        $category = basename(request_var('category', ''));
                        $can_upload = file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads ? true : false;
                        // Did we submit?
                        if ($update) {
                            $group_name = utf8_normalize_nfc(request_var('group_name', '', true));
                            $group_desc = utf8_normalize_nfc(request_var('group_desc', '', true));
                            $group_type = request_var('group_type', GROUP_FREE);
                            $allow_desc_bbcode = request_var('desc_parse_bbcode', false);
                            $allow_desc_urls = request_var('desc_parse_urls', false);
                            $allow_desc_smilies = request_var('desc_parse_smilies', false);
                            $submit_ary = array('colour' => request_var('group_colour', ''), 'rank' => request_var('group_rank', 0), 'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0, 'message_limit' => request_var('group_message_limit', 0), 'max_recipients' => request_var('group_max_recipients', 0));
                            $data['uploadurl'] = request_var('uploadurl', '');
                            $data['remotelink'] = request_var('remotelink', '');
                            $data['width'] = request_var('width', '');
                            $data['height'] = request_var('height', '');
                            $delete = request_var('delete', '');
                            if (!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl'] || $data['remotelink']) {
                                // Avatar stuff
                                $var_ary = array('uploadurl' => array('string', true, 5, 255), 'remotelink' => array('string', true, 5, 255), 'width' => array('string', true, 1, 3), 'height' => array('string', true, 1, 3));
                                if (!($error = validate_data($data, $var_ary))) {
                                    $data['user_id'] = "g{$group_id}";
                                    if ((!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl']) && $can_upload) {
                                        list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_upload($data, $error);
                                    } else {
                                        if ($data['remotelink']) {
                                            list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_remote($data, $error);
                                        }
                                    }
                                }
                            } else {
                                if ($avatar_select && $config['allow_avatar_local']) {
                                    // check avatar gallery
                                    if (is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category)) {
                                        $submit_ary['avatar_type'] = AVATAR_GALLERY;
                                        list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select);
                                        $submit_ary['avatar'] = $category . '/' . $avatar_select;
                                    }
                                } else {
                                    if ($delete) {
                                        $submit_ary['avatar'] = '';
                                        $submit_ary['avatar_type'] = $submit_ary['avatar_width'] = $submit_ary['avatar_height'] = 0;
                                    } else {
                                        if ($data['width'] && $data['height']) {
                                            // Only update the dimensions?
                                            if ($config['avatar_max_width'] || $config['avatar_max_height']) {
                                                if ($data['width'] > $config['avatar_max_width'] || $data['height'] > $config['avatar_max_height']) {
                                                    $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
                                                }
                                            }
                                            if (!sizeof($error)) {
                                                if ($config['avatar_min_width'] || $config['avatar_min_height']) {
                                                    if ($data['width'] < $config['avatar_min_width'] || $data['height'] < $config['avatar_min_height']) {
                                                        $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
                                                    }
                                                }
                                            }
                                            if (!sizeof($error)) {
                                                $submit_ary['avatar_width'] = $data['width'];
开发者ID:html,项目名称:PI,代码行数:67,代码来源:ucp_groups.php

示例3: avatar_process_user

/**
* Uploading/Changing user avatar
*/
function avatar_process_user(&$error, $custom_userdata = false)
{
    global $config, $phpbb_root_path, $auth, $user, $db;
    $data = array('uploadurl' => request_var('uploadurl', ''), 'remotelink' => request_var('remotelink', ''), 'width' => request_var('width', 0), 'height' => request_var('height', 0));
    $error = validate_data($data, array('uploadurl' => array('string', true, 5, 255), 'remotelink' => array('string', true, 5, 255), 'width' => array('string', true, 1, 3), 'height' => array('string', true, 1, 3)));
    if (sizeof($error)) {
        return false;
    }
    $sql_ary = array();
    if ($custom_userdata === false) {
        $userdata =& $user->data;
    } else {
        $userdata =& $custom_userdata;
    }
    $data['user_id'] = $userdata['user_id'];
    $change_avatar = $custom_userdata === false ? $auth->acl_get('u_chgavatar') : true;
    $avatar_select = basename(request_var('avatar_select', ''));
    // Can we upload?
    $can_upload = $config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $change_avatar && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
    if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload) {
        list($sql_ary['user_avatar_type'], $sql_ary['user_avatar'], $sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']) = avatar_upload($data, $error);
    } else {
        if ($data['remotelink'] && $change_avatar && $config['allow_avatar_remote']) {
            list($sql_ary['user_avatar_type'], $sql_ary['user_avatar'], $sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']) = avatar_remote($data, $error);
        } else {
            if ($avatar_select && $change_avatar && $config['allow_avatar_local']) {
                $category = basename(request_var('category', ''));
                $sql_ary['user_avatar_type'] = AVATAR_GALLERY;
                $sql_ary['user_avatar'] = $avatar_select;
                // check avatar gallery
                if (!is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category)) {
                    $sql_ary['user_avatar'] = '';
                    $sql_ary['user_avatar_type'] = $sql_ary['user_avatar_width'] = $sql_ary['user_avatar_height'] = 0;
                } else {
                    list($sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $sql_ary['user_avatar']);
                    $sql_ary['user_avatar'] = $category . '/' . $sql_ary['user_avatar'];
                }
            } else {
                if (isset($_POST['delete']) && $change_avatar) {
                    $sql_ary['user_avatar'] = '';
                    $sql_ary['user_avatar_type'] = $sql_ary['user_avatar_width'] = $sql_ary['user_avatar_height'] = 0;
                } else {
                    if (!empty($userdata['user_avatar'])) {
                        // Only update the dimensions
                        if (empty($data['width']) || empty($data['height'])) {
                            if ($dims = avatar_get_dimensions($userdata['user_avatar'], $userdata['user_avatar_type'], $error, $data['width'], $data['height'])) {
                                list($guessed_x, $guessed_y) = $dims;
                                if (empty($data['width'])) {
                                    $data['width'] = $guessed_x;
                                }
                                if (empty($data['height'])) {
                                    $data['height'] = $guessed_y;
                                }
                            }
                        }
                        if (($config['avatar_max_width'] || $config['avatar_max_height']) && ($data['width'] != $userdata['user_avatar_width'] || $data['height'] != $userdata['user_avatar_height'])) {
                            if ($data['width'] > $config['avatar_max_width'] || $data['height'] > $config['avatar_max_height']) {
                                $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
                            }
                        }
                        if (!sizeof($error)) {
                            if ($config['avatar_min_width'] || $config['avatar_min_height']) {
                                if ($data['width'] < $config['avatar_min_width'] || $data['height'] < $config['avatar_min_height']) {
                                    $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
                                }
                            }
                        }
                        if (!sizeof($error)) {
                            $sql_ary['user_avatar_width'] = $data['width'];
                            $sql_ary['user_avatar_height'] = $data['height'];
                        }
                    }
                }
            }
        }
    }
    if (!sizeof($error)) {
        // Do we actually have any data to update?
        if (sizeof($sql_ary)) {
            $ext_new = $ext_old = '';
            if (isset($sql_ary['user_avatar'])) {
                $userdata = $custom_userdata === false ? $user->data : $custom_userdata;
                $ext_new = empty($sql_ary['user_avatar']) ? '' : substr(strrchr($sql_ary['user_avatar'], '.'), 1);
                $ext_old = empty($userdata['user_avatar']) ? '' : substr(strrchr($userdata['user_avatar'], '.'), 1);
                if ($userdata['user_avatar_type'] == AVATAR_UPLOAD) {
                    // Delete old avatar if present
                    if (!empty($userdata['user_avatar']) && empty($sql_ary['user_avatar']) || !empty($userdata['user_avatar']) && !empty($sql_ary['user_avatar']) && $ext_new !== $ext_old) {
                        avatar_delete('user', $userdata);
                    }
                }
            }
            $sql = 'UPDATE ' . USERS_TABLE . '
				SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
				WHERE user_id = ' . ($custom_userdata === false ? $user->data['user_id'] : $custom_userdata['user_id']);
            $db->sql_query($sql);
        }
    }
//.........这里部分代码省略.........
开发者ID:Phatboy82,项目名称:phpbbgarage,代码行数:101,代码来源:functions_user.php

示例4: main


//.........这里部分代码省略.........
                $error = array();
                $user->add_lang('ucp');
                $avatar_select = basename(request_var('avatar_select', ''));
                $category = basename(request_var('category', ''));
                // Did we submit?
                if ($update) {
                    if (!check_form_key($form_key)) {
                        trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
                    }
                    $group_name = utf8_normalize_nfc(request_var('group_name', '', true));
                    $group_desc = utf8_normalize_nfc(request_var('group_desc', '', true));
                    $group_type = request_var('group_type', GROUP_FREE);
                    $allow_desc_bbcode = request_var('desc_parse_bbcode', false);
                    $allow_desc_urls = request_var('desc_parse_urls', false);
                    $allow_desc_smilies = request_var('desc_parse_smilies', false);
                    $data['uploadurl'] = request_var('uploadurl', '');
                    $data['remotelink'] = request_var('remotelink', '');
                    $data['width'] = request_var('width', '');
                    $data['height'] = request_var('height', '');
                    $delete = request_var('delete', '');
                    $submit_ary = array('colour' => request_var('group_colour', ''), 'rank' => request_var('group_rank', 0), 'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0, 'legend' => isset($_REQUEST['group_legend']) ? 1 : 0, 'message_limit' => request_var('group_message_limit', 0), 'max_recipients' => request_var('group_max_recipients', 0), 'founder_manage' => 0, 'skip_auth' => request_var('group_skip_auth', 0));
                    if ($user->data['user_type'] == USER_FOUNDER) {
                        $submit_ary['founder_manage'] = isset($_REQUEST['group_founder_manage']) ? 1 : 0;
                    }
                    if (!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl'] || $data['remotelink']) {
                        // Avatar stuff
                        $var_ary = array('uploadurl' => array('string', true, 5, 255), 'remotelink' => array('string', true, 5, 255), 'width' => array('string', true, 1, 3), 'height' => array('string', true, 1, 3));
                        if (!($error = validate_data($data, $var_ary))) {
                            $data['user_id'] = "g{$group_id}";
                            if ((!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl']) && $can_upload) {
                                list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_upload($data, $error);
                            } else {
                                if ($data['remotelink']) {
                                    list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_remote($data, $error);
                                }
                            }
                        }
                    } else {
                        if ($avatar_select && $config['allow_avatar_local']) {
                            // check avatar gallery
                            if (is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category)) {
                                $submit_ary['avatar_type'] = AVATAR_GALLERY;
                                list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select);
                                $submit_ary['avatar'] = $category . '/' . $avatar_select;
                            }
                        } else {
                            if ($delete) {
                                $submit_ary['avatar'] = '';
                                $submit_ary['avatar_type'] = $submit_ary['avatar_width'] = $submit_ary['avatar_height'] = 0;
                            } else {
                                if ($data['width'] && $data['height']) {
                                    // Only update the dimensions?
                                    if ($config['avatar_max_width'] || $config['avatar_max_height']) {
                                        if ($data['width'] > $config['avatar_max_width'] || $data['height'] > $config['avatar_max_height']) {
                                            $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
                                        }
                                    }
                                    if (!sizeof($error)) {
                                        if ($config['avatar_min_width'] || $config['avatar_min_height']) {
                                            if ($data['width'] < $config['avatar_min_width'] || $data['height'] < $config['avatar_min_height']) {
                                                $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
                                            }
                                        }
                                    }
                                    if (!sizeof($error)) {
                                        $submit_ary['avatar_width'] = $data['width'];
开发者ID:ubick,项目名称:lorekeepers.org,代码行数:67,代码来源:acp_groups.php

示例5: main


//.........这里部分代码省略.........
                if ($action == 'edit' && !$group_id) {
                    trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action));
                }
                if ($action == 'add' && !$auth->acl_get('a_groupadd')) {
                    trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action));
                }
                $error = array();
                $user->add_lang('ucp');
                $avatar_select = basename(request_var('avatar_select', ''));
                $category = basename(request_var('category', ''));
                // Did we submit?
                if ($update) {
                    $group_name = request_var('group_name', '', true);
                    $group_desc = request_var('group_desc', '', true);
                    $group_type = request_var('group_type', GROUP_FREE);
                    $allow_desc_bbcode = request_var('desc_parse_bbcode', false);
                    $allow_desc_urls = request_var('desc_parse_urls', false);
                    $allow_desc_smilies = request_var('desc_parse_smilies', false);
                    $data['uploadurl'] = request_var('uploadurl', '');
                    $data['remotelink'] = request_var('remotelink', '');
                    $delete = request_var('delete', '');
                    $submit_ary = array('colour' => request_var('group_colour', ''), 'rank' => request_var('group_rank', 0), 'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0, 'legend' => isset($_REQUEST['group_legend']) ? 1 : 0, 'message_limit' => request_var('group_message_limit', 0));
                    if (!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl'] || $data['remotelink']) {
                        $data['width'] = request_var('width', '');
                        $data['height'] = request_var('height', '');
                        // Avatar stuff
                        $var_ary = array('uploadurl' => array('string', true, 5, 255), 'remotelink' => array('string', true, 5, 255), 'width' => array('string', true, 1, 3), 'height' => array('string', true, 1, 3));
                        if (!($error = validate_data($data, $var_ary))) {
                            $data['user_id'] = "g{$group_id}";
                            if ((!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl']) && $can_upload) {
                                list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_upload($data, $error);
                            } else {
                                if ($data['remotelink']) {
                                    list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_remote($data, $error);
                                }
                            }
                        }
                    } else {
                        if ($avatar_select && $config['allow_avatar_local']) {
                            // check avatar gallery
                            if (is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category)) {
                                $submit_ary['avatar_type'] = AVATAR_GALLERY;
                                list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select);
                                $submit_ary['avatar'] = $category . '/' . $avatar_select;
                            }
                        } else {
                            if ($delete) {
                                $submit_ary['avatar'] = '';
                                $submit_ary['avatar_type'] = $submit_ary['avatar_width'] = $submit_ary['avatar_height'] = 0;
                            }
                        }
                    }
                    if (isset($submit_ary['avatar']) && $submit_ary['avatar'] && (!isset($group_row['group_avatar']) || $group_row['group_avatar'] != $submit_ary['avatar']) || $delete) {
                        if (isset($group_row['group_avatar']) && $group_row['group_avatar']) {
                            avatar_delete($group_row['group_avatar']);
                        }
                    }
                    if (!sizeof($error)) {
                        // Only set the rank, colour, etc. if it's changed or if we're adding a new
                        // group. This prevents existing group members being updated if no changes
                        // were made.
                        $group_attributes = array();
                        $test_variables = array('rank', 'colour', 'avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'receive_pm', 'legend', 'message_limit');
                        foreach ($test_variables as $test) {
                            if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test])) {
                                $group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test];
开发者ID:yunsite,项目名称:gloryroad,代码行数:67,代码来源:acp_groups.php

示例6: ucp_profile


//.........这里部分代码省略.........
                        $message = $_CLASS['core_user']->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_UCP'], '<a href="' . $module_link . '\\>', '</a>');
                        trigger_error($message);
                    }
                    // Replace "error" strings with their real, localised form
                    $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$_CLASS['core_user']->lang['\\1'])) ? \$_CLASS['core_user']->lang['\\1'] : '\\1'", $error);
                }
                $signature_preview = '';
                if ($preview && $signature) {
                    // Now parse it for displaying
                    $signature_preview = $message_parser->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, false);
                    unset($message_parser);
                }
                decode_message($signature, $_CLASS['core_user']->data['user_sig_bbcode_uid']);
                $_CLASS['core_template']->assign(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'SIGNATURE' => $signature, 'SIGNATURE_PREVIEW' => $signature_preview, 'S_HTML_CHECKED' => !$enable_html ? 'checked="checked"' : '', 'S_BBCODE_CHECKED' => !$enable_bbcode ? 'checked="checked"' : '', 'S_SMILIES_CHECKED' => !$enable_smilies ? 'checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => !$enable_urls ? 'checked="checked"' : '', 'HTML_STATUS' => $config['allow_sig_html'] ? $_CLASS['core_user']->lang['HTML_IS_ON'] : $_CLASS['core_user']->lang['HTML_IS_OFF'], 'BBCODE_STATUS' => $config['allow_sig_bbcode'] ? sprintf($_CLASS['core_user']->lang['BBCODE_IS_ON'], '<a href="' . generate_link('Forums&amp;file=faq&amp;mode=bbcode') . '" target="_phpbbcode">', '</a>') : sprintf($_CLASS['core_user']->lang['BBCODE_IS_OFF'], '<a href="' . generate_link('Forums&amp;file=faq&amp;mode=bbcode') . '" target="_phpbbcode">', '</a>'), 'SMILIES_STATUS' => $config['allow_sig_smilies'] ? $_CLASS['core_user']->lang['SMILIES_ARE_ON'] : $_CLASS['core_user']->lang['SMILIES_ARE_OFF'], 'IMG_STATUS' => $config['allow_sig_img'] ? $_CLASS['core_user']->lang['IMAGES_ARE_ON'] : $_CLASS['core_user']->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $config['allow_sig_flash'] ? $_CLASS['core_user']->lang['FLASH_IS_ON'] : $_CLASS['core_user']->lang['FLASH_IS_OFF'], 'L_SIGNATURE_EXPLAIN' => sprintf($_CLASS['core_user']->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), 'S_HTML_ALLOWED' => $config['allow_sig_html'], 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies']));
                break;
            case 'avatar':
                $display_gallery = isset($_POST['display_gallery']);
                $folder = isset($_REQUEST['category']) ? str_replace(array('../', '..\\', './', '.\\'), '', $_REQUEST['category']) : false;
                $delete = isset($_POST['delete']);
                // Can we upload?
                $can_upload = file_exists($config['avatar_path']) && is_writeable($config['avatar_path']) && @ini_get('file_uploads') ? true : false;
                if ($submit) {
                    $gallery_avatar = isset($_POST['avatarselect']) ? str_replace(array('../', '..\\', './', '.\\'), '', $_POST['avatarselect']) : false;
                    if ($config['allow_avatar_local'] && $gallery_avatar) {
                        if (!file_exists($config['avatar_gallery_path'] . '/' . $gallery_avatar)) {
                            $error[] = 'BAD_AVATAR';
                        } else {
                            $type = AVATAR_GALLERY;
                            $filename = $gallery_avatar;
                            list($width, $height) = getimagesize($config['avatar_gallery_path'] . '/' . $gallery_avatar);
                        }
                    } else {
                        $data['uploadurl'] = get_variable('uploadurl', 'POST', false);
                        $data['remotelink'] = get_variable('remotelink', 'POST', '');
                        $data['width'] = get_variable('width', 'POST', '');
                        $data['height'] = get_variable('height', 'POST', '');
                        $data['user_id'] = $_CLASS['core_user']->data['user_id'];
                        require_once $site_file_root . 'includes/forums/functions_user.php';
                        if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload) {
                            list($type, $filename, $width, $height) = avatar_upload($data, $error);
                        } elseif ($data['remotelink'] && $config['allow_avatar_remote']) {
                            list($type, $filename, $width, $height) = avatar_remote($data, $error);
                        } elseif ($delete) {
                            $type = $filename = $width = $height = '';
                        } else {
                            $error[] = 'IM_LOST';
                        }
                    }
                    if (empty($error)) {
                        $sql_ary = array('user_avatar' => $filename, 'user_avatar_type' => $type, 'user_avatar_width' => $width, 'user_avatar_height' => $height);
                        $sql = 'UPDATE ' . USERS_TABLE . ' 
							SET ' . $_CLASS['core_db']->sql_build_array('UPDATE', $sql_ary) . ' 
							WHERE user_id = ' . $_CLASS['core_user']->data['user_id'];
                        $_CLASS['core_db']->sql_query($sql);
                        // Delete old avatar if present
                        if ($_CLASS['core_user']->data['user_avatar'] && $filename != $_CLASS['core_user']->data['user_avatar'] && $_CLASS['core_user']->data['user_avatar_type'] != AVATAR_GALLERY) {
                            avatar_delete($_CLASS['core_user']->data['user_avatar']);
                        }
                        $_CLASS['core_display']->meta_refresh(3, $module_link);
                        $message = $_CLASS['core_user']->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_UCP'], '<a href="' . $module_link . '">', '</a>');
                        trigger_error($message);
                    }
                    $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$_CLASS['core_user']->lang['\\1'])) ? \$_CLASS['core_user']->lang['\\1'] : '\\1'", $error);
                }
                // Generate users avatar
                $avatar_img = '';
                if ($_CLASS['core_user']->data['user_avatar']) {
                    switch ($_CLASS['core_user']->data['user_avatar_type']) {
                        case AVATAR_UPLOAD:
                            $avatar_img = $config['avatar_path'] . '/';
                            break;
                        case AVATAR_GALLERY:
                            $avatar_img = $config['avatar_gallery_path'] . '/';
                            break;
                    }
                    $avatar_img .= $_CLASS['core_user']->data['user_avatar'];
                    $avatar_img = '<img src="' . $avatar_img . '" width="' . $_CLASS['core_user']->data['user_avatar_width'] . '" height="' . $_CLASS['core_user']->data['user_avatar_height'] . '" border="0" alt="" />';
                }
                $_CLASS['core_template']->assign(array('ERROR' => empty($error) ? '' : implode('<br />', $error), 'AVATAR' => $avatar_img, 'AVATAR_SIZE' => $config['avatar_filesize'], 'S_FORM_ENCTYPE' => $can_upload ? ' enctype="multipart/form-data"' : '', 'L_AVATAR_EXPLAIN' => sprintf($_CLASS['core_user']->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024))));
                if ($display_gallery && $config['allow_avatar_local']) {
                    require_once $site_file_root . 'includes/functions_user.php';
                    $avatar_list = avatar_gallery($folder, $folders, $error);
                    array_unshift($folders, '');
                    $s_category_options = '';
                    foreach ($folders as $cat) {
                        $s_category_options .= '<option value="' . $cat . '"' . ($cat == $folder ? ' selected="selected"' : '') . '>' . ($cat ? $cat : '--') . '</option>';
                    }
                    $_CLASS['core_template']->assign(array('S_DISPLAY_GALLERY' => true, 'S_CAT_OPTIONS' => $s_category_options));
                    foreach ($avatar_list as $avatar) {
                        $_CLASS['core_template']->assign_vars_array('avatar', array('AVATAR_IMAGE' => $config['avatar_gallery_path'] . '/' . $avatar['file'], 'AVATAR_NAME' => $avatar['name'], 'AVATAR_FILE' => $avatar['file']));
                    }
                    unset($avatar_list);
                } else {
                    $_CLASS['core_template']->assign(array('AVATAR' => $avatar_img, 'AVATAR_SIZE' => $config['avatar_filesize'], 'WIDTH' => $_CLASS['core_user']->data['user_avatar_width'], 'HEIGHT' => $_CLASS['core_user']->data['user_avatar_height'], 'S_CAN_UPLOAD' => $can_upload, 'S_LINK_AVATAR' => $config['allow_avatar_remote'], 'S_GALLERY_AVATAR' => $config['allow_avatar_local']));
                }
                break;
        }
        $_CLASS['core_template']->assign_array(array('L_TITLE' => $_CLASS['core_user']->lang['UCP_PROFILE_' . strtoupper($mode)], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => $module_link));
        $this->display($_CLASS['core_user']->lang['UCP_PROFILE'], 'ucp_profile_' . $mode . '.html');
    }
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:101,代码来源:ucp_profile.php

示例7: list

                    $error[] = 'BAD_AVATAR';
                } else {
                    $type = AVATAR_GALLERY;
                    $filename = $gallery_avatar;
                    list($width, $height) = getimagesize($_CORE_CONFIG['global']['path_avatar_gallery'] . '/' . $gallery_avatar);
                }
            } else {
                $data['uploadurl'] = get_variable('uploadurl', 'POST', false);
                $data['remotelink'] = get_variable('remotelink', 'POST', '');
                $data['width'] = get_variable('width', 'POST', '');
                $data['height'] = get_variable('height', 'POST', '');
                $data['user_id'] = $_CLASS['core_user']->data['user_id'];
                if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload) {
                    list($type, $filename, $width, $height) = avatar_upload($data, $error);
                } elseif ($data['remotelink'] && $config['allow_avatar_remote']) {
                    list($type, $filename, $width, $height) = avatar_remote($data, $error);
                } elseif ($delete) {
                    $filename = '';
                    $type = $width = $height = 0;
                } else {
                    $error[] = 'IM_LOST';
                }
            }
            if (empty($error)) {
                $sql_ary = array('user_avatar' => (string) $filename, 'user_avatar_type' => (int) $type, 'user_avatar_width' => (int) $width, 'user_avatar_height' => (int) $height);
                $sql = 'UPDATE ' . CORE_USERS_TABLE . ' 
					SET ' . $_CLASS['core_db']->sql_build_array('UPDATE', $sql_ary) . ' 
					WHERE user_id = ' . $_CLASS['core_user']->data['user_id'];
                $_CLASS['core_db']->sql_query($sql);
                /* Delete old avatar if present */
                if ($_CLASS['core_user']->data['user_avatar'] && $filename !== $_CLASS['core_user']->data['user_avatar'] && $_CLASS['core_user']->data['user_avatar_type'] != AVATAR_GALLERY) {
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:31,代码来源:ucp_profile.php

示例8: main


//.........这里部分代码省略.........
                decode_message($signature, $user->data['user_sig_bbcode_uid']);
                $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'SIGNATURE' => $signature, 'SIGNATURE_PREVIEW' => $signature_preview, 'S_BBCODE_CHECKED' => !$enable_bbcode ? 'checked="checked"' : '', 'S_SMILIES_CHECKED' => !$enable_smilies ? 'checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => !$enable_urls ? 'checked="checked"' : '', 'BBCODE_STATUS' => $config['allow_sig_bbcode'] ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '" onclick="target=\'_phpbbcode\';">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '" onclick="target=\'_phpbbcode\';">', '</a>'), 'SMILIES_STATUS' => $config['allow_sig_smilies'] ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], 'IMG_STATUS' => $config['allow_sig_img'] ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $config['allow_sig_flash'] ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'], 'S_BBCODE_IMG' => $config['allow_sig_img'] ? true : false, 'S_BBCODE_FLASH' => $config['allow_sig_flash'] ? true : false));
                // Build custom bbcodes array
                $sql = 'SELECT bbcode_id, bbcode_tag 
					FROM ' . BBCODES_TABLE . '
					WHERE display_on_posting = 1';
                $result = $db->sql_query($sql);
                $i = 0;
                while ($row = $db->sql_fetchrow($result)) {
                    $template->assign_block_vars('custom_tags', array('BBCODE_NAME' => "'[{$row['bbcode_tag']}]', '[/" . str_replace('=', '', $row['bbcode_tag']) . "]'", 'BBCODE_ID' => 22 + $i * 2, 'BBCODE_TAG' => $row['bbcode_tag']));
                    $i++;
                }
                $db->sql_freeresult($result);
                break;
            case 'avatar':
                $display_gallery = isset($_POST['display_gallery']) ? true : false;
                $delete = isset($_POST['delete']) ? true : false;
                $avatar_select = basename(request_var('avatar_select', ''));
                $category = basename(request_var('category', ''));
                // Can we upload?
                $can_upload = $config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && is_writeable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
                if ($submit) {
                    $var_ary = array('uploadurl' => (string) '', 'remotelink' => (string) '', 'width' => (string) '', 'height' => (string) '');
                    foreach ($var_ary as $var => $default) {
                        $data[$var] = request_var($var, $default);
                    }
                    $var_ary = array('uploadurl' => array('string', true, 5, 255), 'remotelink' => array('string', true, 5, 255), 'width' => array('string', true, 1, 3), 'height' => array('string', true, 1, 3));
                    $error = validate_data($data, $var_ary);
                    if (!sizeof($error)) {
                        $data['user_id'] = $user->data['user_id'];
                        if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload) {
                            list($type, $filename, $width, $height) = avatar_upload($data, $error);
                        } else {
                            if ($data['remotelink'] && $auth->acl_get('u_chgavatar') && $config['allow_avatar_remote']) {
                                list($type, $filename, $width, $height) = avatar_remote($data, $error);
                            } else {
                                if ($avatar_select && $auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) {
                                    $type = AVATAR_GALLERY;
                                    $filename = $avatar_select;
                                    // check avatar gallery
                                    if (!is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category)) {
                                        $filename = '';
                                        $type = $width = $height = 0;
                                    } else {
                                        list($width, $height) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $filename);
                                        $filename = $category . '/' . $filename;
                                    }
                                } else {
                                    if ($delete && $auth->acl_get('u_chgavatar')) {
                                        $filename = '';
                                        $type = $width = $height = 0;
                                    } else {
                                        $data = array();
                                    }
                                }
                            }
                        }
                    }
                    if (!sizeof($error)) {
                        // Do we actually have any data to update?
                        if (sizeof($data)) {
                            $sql_ary = array('user_avatar' => $filename, 'user_avatar_type' => $type, 'user_avatar_width' => $width, 'user_avatar_height' => $height);
                            $sql = 'UPDATE ' . USERS_TABLE . '
								SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
								WHERE user_id = ' . $user->data['user_id'];
                            $db->sql_query($sql);
开发者ID:yunsite,项目名称:gloryroad,代码行数:67,代码来源:ucp_profile.php

示例9: tt_copy_avatar

function tt_copy_avatar($uid, $avatar_url)
{
    global $config, $phpbb_root_path, $db, $user, $phpEx;
    $can_upload = $config['allow_avatar_remote'];
    if ($can_upload && !empty($avatar_url)) {
        $avatar['user_id'] = $uid;
        $avatar['uploadurl'] = '';
        $avatar['remotelink'] = $avatar_url;
        $avatar['width'] = $config['avatar_max_width'];
        $avatar['height'] = $config['avatar_max_height'];
        $error = array();
        $upload_response = avatar_remote($avatar, $error);
        if (empty($error)) {
            list($sql_ary['user_avatar_type'], $sql_ary['user_avatar'], $sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']) = $upload_response;
            $sql = 'UPDATE ' . USERS_TABLE . '
			SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
			WHERE user_id = ' . $uid;
            $db->sql_query($sql);
        }
    }
}
开发者ID:danielgospodinow,项目名称:GamingZone,代码行数:21,代码来源:sign_in.php

示例10: ucp_profile


//.........这里部分代码省略.........
                        $_CLASS['core_db']->sql_query($sql);
                        $message = $_CLASS['core_user']->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_UCP'], '<a href="' . $module_link . '">', '</a>');
                        trigger_error($message);
                    }
                }
                if ($preview && $signature) {
                    // Now parse it for displaying
                    $signature_preview = $message_parser->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, false);
                    unset($message_parser);
                }
                if ($signature) {
                    decode_message($signature, $_CLASS['core_user']->data['user_sig_bbcode_uid']);
                }
                $_CLASS['core_template']->assign_array(array('ERROR' => empty($error) ? '' : implode('<br />', $error), 'SIGNATURE' => $signature, 'SIGNATURE_PREVIEW' => $signature_preview, 'S_HTML_CHECKED' => $enable_html ? '' : 'checked="checked"', 'S_BBCODE_CHECKED' => $enable_bbcode ? '' : 'checked="checked"', 'S_SMILIES_CHECKED' => $enable_smilies ? '' : 'checked="checked"', 'S_MAGIC_URL_CHECKED' => $enable_urls ? '' : 'checked="checked"', 'HTML_STATUS' => true ? $_CLASS['core_user']->get_lang('HTML_IS_ON') : $_CLASS['core_user']->get_lang('HTML_IS_OFF'), 'BBCODE_STATUS' => true ? sprintf($_CLASS['core_user']->get_lang('BBCODE_IS_ON'), '<a href="' . generate_link('Forums&amp;file=faq&amp;mode=bbcode') . '" target="_phpbbcode">', '</a>') : sprintf($_CLASS['core_user']->get_lang('BBCODE_IS_OFF'), '<a href="' . generate_link('Forums&amp;file=faq&amp;mode=bbcode') . '" target="_phpbbcode">', '</a>'), 'SMILIES_STATUS' => true ? $_CLASS['core_user']->get_lang('SMILIES_ARE_ON') : $_CLASS['core_user']->get_lang('SMILIES_ARE_OFF'), 'IMG_STATUS' => true ? $_CLASS['core_user']->get_lang('IMAGES_ARE_ON') : $_CLASS['core_user']->get_lang('IMAGES_ARE_OFF'), 'FLASH_STATUS' => true ? $_CLASS['core_user']->get_lang('FLASH_IS_ON') : $_CLASS['core_user']->get_lang('FLASH_IS_OFF'), 'L_SIGNATURE_EXPLAIN' => sprintf($_CLASS['core_user']->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), 'S_HTML_ALLOWED' => true, 'S_BBCODE_ALLOWED' => true, 'S_SMILIES_ALLOWED' => true));
                break;
            case 'avatar':
                $display_gallery = isset($_POST['display_gallery']);
                $folder = isset($_POST['category']) ? str_replace(array('../', '..\\', './', '.\\'), '', $_POST['category']) : false;
                $delete = isset($_POST['delete']);
                // Can we upload?
                $can_upload = file_exists($config['avatar_path']) && is_writeable($config['avatar_path']) && @ini_get('file_uploads') ? true : false;
                if ($submit) {
                    $gallery_avatar = isset($_POST['avatarselect']) ? str_replace(array('../', '..\\', './', '.\\'), '', $_POST['avatarselect']) : false;
                    if ($config['allow_avatar_local'] && $gallery_avatar) {
                        if (!file_exists($config['avatar_gallery_path'] . '/' . $gallery_avatar)) {
                            $error[] = 'BAD_AVATAR';
                        } else {
                            $type = AVATAR_GALLERY;
                            $filename = $gallery_avatar;
                            list($width, $height) = getimagesize($config['avatar_gallery_path'] . '/' . $gallery_avatar);
                        }
                    } else {
                        $data['uploadurl'] = get_variable('uploadurl', 'POST', false);
                        $data['remotelink'] = get_variable('remotelink', 'POST', '');
                        $data['width'] = get_variable('width', 'POST', '');
                        $data['height'] = get_variable('height', 'POST', '');
                        $data['user_id'] = $_CLASS['core_user']->data['user_id'];
                        if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload) {
                            list($type, $filename, $width, $height) = avatar_upload($data, $error);
                        } elseif ($data['remotelink'] && $config['allow_avatar_remote']) {
                            list($type, $filename, $width, $height) = avatar_remote($data, $error);
                        } elseif ($delete) {
                            $filename = '';
                            $type = $width = $height = 0;
                        } else {
                            $error[] = 'IM_LOST';
                        }
                    }
                    if (empty($error)) {
                        $sql_ary = array('user_avatar' => (string) $filename, 'user_avatar_type' => (int) $type, 'user_avatar_width' => (int) $width, 'user_avatar_height' => (int) $height);
                        $sql = 'UPDATE ' . USERS_TABLE . ' 
							SET ' . $_CLASS['core_db']->sql_build_array('UPDATE', $sql_ary) . ' 
							WHERE user_id = ' . $_CLASS['core_user']->data['user_id'];
                        $_CLASS['core_db']->sql_query($sql);
                        // Delete old avatar if present
                        if ($_CLASS['core_user']->data['user_avatar'] && $filename != $_CLASS['core_user']->data['user_avatar'] && $_CLASS['core_user']->data['user_avatar_type'] != AVATAR_GALLERY) {
                            avatar_delete($_CLASS['core_user']->data['user_avatar']);
                        }
                        $_CLASS['core_display']->meta_refresh(3, $module_link);
                        $message = $_CLASS['core_user']->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_UCP'], '<a href="' . $module_link . '">', '</a>');
                        trigger_error($message);
                    }
                    $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$_CLASS['core_user']->lang['\\1'])) ? \$_CLASS['core_user']->lang['\\1'] : '\\1'", $error);
                }
                // Generate users avatar
                $avatar_img = '';
                if ($_CLASS['core_user']->data['user_avatar']) {
                    switch ($_CLASS['core_user']->data['user_avatar_type']) {
                        case AVATAR_UPLOAD:
                            $avatar_img = $config['avatar_path'] . '/';
                            break;
                        case AVATAR_GALLERY:
                            $avatar_img = $config['avatar_gallery_path'] . '/';
                            break;
                    }
                    $avatar_img .= $_CLASS['core_user']->data['user_avatar'];
                    $avatar_img = '<img src="' . $avatar_img . '" width="' . $_CLASS['core_user']->data['user_avatar_width'] . '" height="' . $_CLASS['core_user']->data['user_avatar_height'] . '" border="0" alt="" />';
                }
                $_CLASS['core_template']->assign_array(array('ERROR' => empty($error) ? '' : implode('<br />', $error), 'AVATAR' => $avatar_img, 'AVATAR_SIZE' => $config['avatar_filesize'], 'S_FORM_ENCTYPE' => $can_upload ? ' enctype="multipart/form-data"' : '', 'L_AVATAR_EXPLAIN' => sprintf($_CLASS['core_user']->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024))));
                if ($display_gallery && $config['allow_avatar_local']) {
                    require_once $site_file_root . 'includes/functions_user.php';
                    $avatar_list = avatar_gallery($folder, $folders, $error);
                    array_unshift($folders, '');
                    $s_category_options = '';
                    foreach ($folders as $cat) {
                        $s_category_options .= '<option value="' . $cat . '"' . ($cat == $folder ? ' selected="selected"' : '') . '>' . ($cat ? $cat : '--') . '</option>';
                    }
                    $_CLASS['core_template']->assign_array(array('S_DISPLAY_GALLERY' => true, 'S_CAT_OPTIONS' => $s_category_options));
                    foreach ($avatar_list as $avatar) {
                        $_CLASS['core_template']->assign_vars_array('avatar', array('AVATAR_IMAGE' => $config['avatar_gallery_path'] . '/' . $avatar['file'], 'AVATAR_NAME' => $avatar['name'], 'AVATAR_FILE' => $avatar['file']));
                    }
                    unset($avatar_list);
                } else {
                    $_CLASS['core_template']->assign_array(array('AVATAR' => $avatar_img, 'AVATAR_SIZE' => $config['avatar_filesize'], 'WIDTH' => $_CLASS['core_user']->data['user_avatar_width'], 'HEIGHT' => $_CLASS['core_user']->data['user_avatar_height'], 'S_CAN_UPLOAD' => $can_upload, 'S_LINK_AVATAR' => $config['allow_avatar_remote'], 'S_GALLERY_AVATAR' => $config['allow_avatar_local']));
                }
                break;
        }
        $_CLASS['core_template']->assign_array(array('L_TITLE' => $_CLASS['core_user']->lang['UCP_PROFILE_' . strtoupper($mode)], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => $module_link));
        $this->display($_CLASS['core_user']->lang['UCP_PROFILE'], 'ucp_profile_' . $mode . '.html');
    }
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:101,代码来源:ucp_profile.php


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