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


PHP avatar_gallery函数代码示例

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


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

示例1: main


//.........这里部分代码省略.........
                        $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'];
                                                $submit_ary['avatar_height'] = $data['height'];
                                            }
                                        }
                                    }
                                }
                            }
                            if (isset($submit_ary['avatar']) && $submit_ary['avatar'] && !isset($group_row['group_avatar']) || $delete) {
开发者ID:html,项目名称:PI,代码行数:67,代码来源:ucp_groups.php

示例2: main


//.........这里部分代码省略.........
                    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);
                            // Delete old avatar if present
                            if ($user_row['user_avatar'] && $filename != $user_row['user_avatar'] && $user_row['user_avatar_type'] != AVATAR_GALLERY) {
                                avatar_delete($user_row['user_avatar']);
                            }
                        }
                        trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
                    }
开发者ID:yunsite,项目名称:gloryroad,代码行数:67,代码来源:acp_users.php

示例3: main


//.........这里部分代码省略.........
                // Get additional profile fields and assign them to the template block var 'profile_fields'
                $user->get_profile_fields($user->data['user_id']);
                $cp->generate_profile_fields('profile', $user->get_iso_lang_id());
                break;
            case 'signature':
                if (!$auth->acl_get('u_sig')) {
                    trigger_error('NO_AUTH_SIGNATURE');
                }
                include $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
                include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
                $enable_bbcode = $config['allow_sig_bbcode'] ? (bool) $user->optionget('sig_bbcode') : false;
                $enable_smilies = $config['allow_sig_smilies'] ? (bool) $user->optionget('sig_smilies') : false;
                $enable_urls = $config['allow_sig_links'] ? (bool) $user->optionget('sig_links') : false;
                $signature = utf8_normalize_nfc(request_var('signature', (string) $user->data['user_sig'], true));
                add_form_key('ucp_sig');
                if ($submit || $preview) {
                    include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
                    $enable_bbcode = $config['allow_sig_bbcode'] ? request_var('disable_bbcode', false) ? false : true : false;
                    $enable_smilies = $config['allow_sig_smilies'] ? request_var('disable_smilies', false) ? false : true : false;
                    $enable_urls = $config['allow_sig_links'] ? request_var('disable_magic_url', false) ? false : true : false;
                    if (!sizeof($error)) {
                        $message_parser = new parse_message($signature);
                        // Allowing Quote BBCode
                        $message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, $config['allow_sig_links'], true, 'sig');
                        if (sizeof($message_parser->warn_msg)) {
                            $error[] = implode('<br />', $message_parser->warn_msg);
                        }
                        if (!check_form_key('ucp_sig')) {
                            $error[] = 'FORM_INVALID';
                        }
                        if (!sizeof($error) && $submit) {
                            $user->optionset('sig_bbcode', $enable_bbcode);
                            $user->optionset('sig_smilies', $enable_smilies);
                            $user->optionset('sig_links', $enable_urls);
                            $sql_ary = array('user_sig' => (string) $message_parser->message, 'user_options' => $user->data['user_options'], 'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid, 'user_sig_bbcode_bitfield' => $message_parser->bbcode_bitfield);
                            $sql = 'UPDATE ' . USERS_TABLE . '
								SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
								WHERE user_id = ' . $user->data['user_id'];
                            $db->sql_query($sql);
                            $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
                            trigger_error($message);
                        }
                    }
                    // Replace "error" strings with their real, localised form
                    $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
                }
                $signature_preview = '';
                if ($preview) {
                    // Now parse it for displaying
                    $signature_preview = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);
                    unset($message_parser);
                }
                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') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '">', '</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'], 'URL_STATUS' => $config['allow_sig_links'] ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], 'MAX_FONT_SIZE' => (int) $config['max_sig_font_size'], '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, 'S_LINKS_ALLOWED' => $config['allow_sig_links'] ? true : false));
                // Build custom bbcodes array
                display_custom_bbcodes();
                break;
            case 'avatar':
                include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
                $display_gallery = request_var('display_gallery', '0');
                $avatar_select = basename(request_var('avatar_select', ''));
                $category = basename(request_var('category', ''));
                $can_upload = file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
                add_form_key('ucp_avatar');
                if ($submit) {
                    if (check_form_key('ucp_avatar')) {
                        if (avatar_process_user($error, false, $can_upload)) {
                            meta_refresh(3, $this->u_action);
                            $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
                            trigger_error($message);
                        }
                    } else {
                        $error[] = 'FORM_INVALID';
                    }
                    // Replace "error" strings with their real, localised form
                    $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
                }
                if (!$config['allow_avatar'] && $user->data['user_avatar_type']) {
                    $error[] = $user->lang['AVATAR_NOT_ALLOWED'];
                } else {
                    if ($user->data['user_avatar_type'] == AVATAR_UPLOAD && !$config['allow_avatar_upload'] || $user->data['user_avatar_type'] == AVATAR_REMOTE && !$config['allow_avatar_remote'] || $user->data['user_avatar_type'] == AVATAR_GALLERY && !$config['allow_avatar_local']) {
                        $error[] = $user->lang['AVATAR_TYPE_NOT_ALLOWED'];
                    }
                }
                $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'AVATAR' => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height'], 'USER_AVATAR', true), 'AVATAR_SIZE' => $config['avatar_filesize'], 'U_GALLERY' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=profile&amp;mode=avatar&amp;display_gallery=1'), 'S_FORM_ENCTYPE' => $can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload']) ? ' enctype="multipart/form-data"' : '', 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024)));
                if ($config['allow_avatar'] && $display_gallery && $auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) {
                    avatar_gallery($category, $avatar_select, 4);
                } else {
                    if ($config['allow_avatar']) {
                        $avatars_enabled = $can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload']) || $auth->acl_get('u_chgavatar') && ($config['allow_avatar_local'] || $config['allow_avatar_remote']) ? true : false;
                        $template->assign_vars(array('AVATAR_WIDTH' => request_var('width', $user->data['user_avatar_width']), 'AVATAR_HEIGHT' => request_var('height', $user->data['user_avatar_height']), 'S_AVATARS_ENABLED' => $avatars_enabled, 'S_UPLOAD_AVATAR_FILE' => $can_upload && $config['allow_avatar_upload'] ? true : false, 'S_UPLOAD_AVATAR_URL' => $can_upload && $config['allow_avatar_remote_upload'] ? true : false, 'S_LINK_AVATAR' => $auth->acl_get('u_chgavatar') && $config['allow_avatar_remote'] ? true : false, 'S_DISPLAY_GALLERY' => $auth->acl_get('u_chgavatar') && $config['allow_avatar_local'] ? true : false));
                    }
                }
                break;
        }
        $template->assign_vars(array('L_TITLE' => $user->lang['UCP_PROFILE_' . strtoupper($mode)], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => $this->u_action));
        // Set desired template
        $this->tpl_name = 'ucp_profile_' . $mode;
        $this->page_title = 'UCP_PROFILE_' . strtoupper($mode);
    }
开发者ID:ahmatjan,项目名称:Crimson,代码行数:101,代码来源:ucp_profile.php

示例4: main


//.........这里部分代码省略.........
                        ${'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_row['user_jabber'] && @extension_loaded('xml') ? false : true, 'VIEW_EMAIL' => $data['viewemail'], 'MASS_EMAIL' => $data['massemail'], 'ALLOW_PM' => $data['allowpm'], 'HIDE_ONLINE' => $data['hideonline'], 'NOTIFY_EMAIL' => $data['notifymethod'] == NOTIFY_EMAIL ? true : false, 'NOTIFY_IM' => $data['notifymethod'] == NOTIFY_IM ? true : false, 'NOTIFY_BOTH' => $data['notifymethod'] == NOTIFY_BOTH ? true : false, 'NOTIFY_PM' => $data['notifypm'], 'POPUP_PM' => $data['popuppm'], 'DST' => $data['dst'], 'BBCODE' => $data['bbcode'], 'SMILIES' => $data['smilies'], 'ATTACH_SIG' => $data['sig'], 'NOTIFY' => $data['notify'], 'VIEW_IMAGES' => $data['view_images'], 'VIEW_FLASH' => $data['view_flash'], 'VIEW_SMILIES' => $data['view_smilies'], 'VIEW_SIGS' => $data['view_sigs'], 'VIEW_AVATARS' => $data['view_avatars'], 'VIEW_WORDCENSOR' => $data['view_wordcensor'], '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' => $data['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($data['lang']), 'S_STYLE_OPTIONS' => style_select($data['style']), 'S_TZ_OPTIONS' => tz_select($data['tz'], true)));
                break;
            case 'avatar':
                include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
                include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
                $can_upload = file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads ? true : false;
                if ($submit) {
                    if (!check_form_key($form_name)) {
                        trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
                    }
                    if (avatar_process_user($error, $user_row, $can_upload)) {
                        trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&amp;u=' . $user_row['user_id']));
                    }
                    // Replace "error" strings with their real, localised form
                    $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
                }
                if (!$config['allow_avatar'] && $user_row['user_avatar_type']) {
                    $error[] = $user->lang['USER_AVATAR_NOT_ALLOWED'];
                } else {
                    if ($user_row['user_avatar_type'] == AVATAR_UPLOAD && !$config['allow_avatar_upload'] || $user_row['user_avatar_type'] == AVATAR_REMOTE && !$config['allow_avatar_remote'] || $user_row['user_avatar_type'] == AVATAR_GALLERY && !$config['allow_avatar_local']) {
                        $error[] = $user->lang['USER_AVATAR_TYPE_NOT_ALLOWED'];
                    }
                }
                // Generate users avatar
                $avatar_img = $user_row['user_avatar'] ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height'], 'USER_AVATAR', true) : '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />';
                $display_gallery = isset($_POST['display_gallery']) ? true : false;
                $avatar_select = basename(request_var('avatar_select', ''));
                $category = basename(request_var('category', ''));
                if ($config['allow_avatar_local'] && $display_gallery) {
                    avatar_gallery($category, $avatar_select, 4);
                }
                $template->assign_vars(array('S_AVATAR' => true, 'S_CAN_UPLOAD' => $can_upload, 'S_UPLOAD_FILE' => $config['allow_avatar'] && $can_upload && $config['allow_avatar_upload'] ? true : false, 'S_REMOTE_UPLOAD' => $config['allow_avatar'] && $can_upload && $config['allow_avatar_remote_upload'] ? true : false, 'S_ALLOW_REMOTE' => $config['allow_avatar'] && $config['allow_avatar_remote'] ? true : false, 'S_DISPLAY_GALLERY' => $config['allow_avatar'] && $config['allow_avatar_local'] && !$display_gallery ? true : false, 'S_IN_GALLERY' => $config['allow_avatar'] && $config['allow_avatar_local'] && $display_gallery ? true : false, 'AVATAR_IMAGE' => $avatar_img, 'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'], 'USER_AVATAR_WIDTH' => $user_row['user_avatar_width'], 'USER_AVATAR_HEIGHT' => $user_row['user_avatar_height'], 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024))));
                break;
            case 'rank':
                if ($submit) {
                    if (!check_form_key($form_name)) {
                        trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
                    }
                    $rank_id = request_var('user_rank', 0);
                    $sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\t\t\tSET user_rank = {$rank_id}\n\t\t\t\t\t\tWHERE user_id = {$user_id}";
                    $db->sql_query($sql);
                    trigger_error($user->lang['USER_RANK_UPDATED'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
                }
                $sql = 'SELECT *
					FROM ' . RANKS_TABLE . '
					WHERE rank_special = 1
					ORDER BY rank_title';
                $result = $db->sql_query($sql);
                $s_rank_options = '<option value="0"' . (!$user_row['user_rank'] ? ' selected="selected"' : '') . '>' . $user->lang['NO_SPECIAL_RANK'] . '</option>';
                while ($row = $db->sql_fetchrow($result)) {
                    $selected = $user_row['user_rank'] && $row['rank_id'] == $user_row['user_rank'] ? ' selected="selected"' : '';
                    $s_rank_options .= '<option value="' . $row['rank_id'] . '"' . $selected . '>' . $row['rank_title'] . '</option>';
                }
                $db->sql_freeresult($result);
                $template->assign_vars(array('S_RANK' => true, 'S_RANK_OPTIONS' => $s_rank_options));
                break;
            case 'sig':
                include_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
                include_once $phpbb_root_path . 'includes/functions_display.' . $phpEx;
                $enable_bbcode = $config['allow_sig_bbcode'] ? (bool) $this->optionget($user_row, 'sig_bbcode') : false;
                $enable_smilies = $config['allow_sig_smilies'] ? (bool) $this->optionget($user_row, 'sig_smilies') : false;
                $enable_urls = $config['allow_sig_links'] ? (bool) $this->optionget($user_row, 'sig_links') : false;
开发者ID:ubick,项目名称:lorekeepers.org,代码行数:67,代码来源:acp_users.php

示例5: main


//.........这里部分代码省略.........
                $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];
                            }
                        }
                        if (!($error = group_create($group_id, $group_type, $group_name, $group_desc, $group_attributes, $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies))) {
                            $group_perm_from = request_var('group_perm_from', 0);
                            // Copy permissions?
                            if ($group_perm_from && $action == 'add') {
                                // From the mysql documentation:
开发者ID:yunsite,项目名称:gloryroad,代码行数:67,代码来源:acp_groups.php

示例6: avatar_upload

        if (!empty($avatar_upload)) {
            $avatar_sql = avatar_upload($avatar_mode, $ficheX->avatar, $ficheX->avatar_type, $avatar_upload, $avatar_name, $avatar_size, $avatar_filetype, $avatar_error);
        } elseif (!empty($avatar_name)) {
            $avatar_error = true;
            show_erreur($strAvatarErreurFileSize);
        }
    } elseif ($avatar_remoteurl != '' && $config['avatar_remote']) {
        if (@file_exists($config['avatars_path'] . '/' . $ficheX->avatar)) {
            @unlink($config['avatars_path'] . '/' . $ficheX->avatar);
        }
        $avatar_sql = avatar_url($avatar_remoteurl, &$avatar_error);
    } elseif ($avatar_gallerie != '' && $config['avatar_gallerie']) {
        if (@file_exists($config['avatars_path'] . '/' . $ficheX->avatar)) {
            @unlink($config['avatars_path'] . '/' . $ficheX->avatar);
        }
        $avatar_sql = avatar_gallery($avatar_gallerie);
    }
    if (!$avatar_error) {
        if ($avatar_sql) {
            $db->update("{$dbprefix}{$type}");
            $db->set("{$avatar_sql}");
            $db->where("id = {$id}");
            $db->exec();
        }
        if ($op_old == 'galerie') {
            echo "<script>this.opener.location=this.opener.location;this.close();</script>";
        } else {
            js_goto("?page=avatars&id={$id}&mode={$mode}");
        }
    }
} elseif ($op == "delete") {
开发者ID:Arnaud-Burn,项目名称:phpTournois,代码行数:31,代码来源:avatars.php

示例7: main


//.........这里部分代码省略.........
                        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'];
                                        $submit_ary['avatar_height'] = $data['height'];
                                    }
                                }
                            }
                        }
                    }
                    if (isset($submit_ary['avatar']) && $submit_ary['avatar'] && !isset($group_row['group_avatar']) || $delete) {
开发者ID:ubick,项目名称:lorekeepers.org,代码行数:67,代码来源:acp_groups.php

示例8: ucp_profile


//.........这里部分代码省略.........
                        }
                    } else {
                        $sql_ary = array('user_sig' => '', 'user_sig_bbcode_uid' => '', 'user_sig_bbcode_bitfield' => (int) '');
                    }
                    if (!sizeof($error) && $submit) {
                        $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);
                        $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']);
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:67,代码来源:ucp_profile.php

示例9: switch

     if ($_CLASS['core_user']->data['user_avatar']) {
         switch ($_CLASS['core_user']->data['user_avatar_type']) {
             case AVATAR_UPLOAD:
                 $avatar_img = $_CORE_CONFIG['global']['path_avatar_upload'] . '/';
                 break;
             case AVATAR_GALLERY:
                 $avatar_img = $_CORE_CONFIG['global']['path_avatar_gallery'] . '/';
                 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) {
         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;
 default:
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:31,代码来源:ucp_profile.php

示例10: main


//.........这里部分代码省略.........
                $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);
                            // Delete old avatar if present
                            if ($user->data['user_avatar'] && $filename != $user->data['user_avatar'] && $user->data['user_avatar_type'] != AVATAR_GALLERY) {
                                avatar_delete($user->data['user_avatar']);
                            }
                        }
                        meta_refresh(3, $this->u_action);
                        $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
开发者ID:yunsite,项目名称:gloryroad,代码行数:67,代码来源:ucp_profile.php

示例11: ucp_profile


//.........这里部分代码省略.........
                    if (empty($error) && $submit) {
                        if ($signature && !empty($message_parser->message)) {
                            $sql_array = array('user_sig' => (string) $message_parser->message, 'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid, 'user_sig_bbcode_bitfield' => (int) $message_parser->bbcode_bitfield);
                        } else {
                            $sql_array = array('user_sig' => (string) '', 'user_sig_bbcode_uid' => (string) '', 'user_sig_bbcode_bitfield' => (int) 0);
                        }
                        $sql = 'UPDATE ' . USERS_TABLE . ' 
							SET ' . $_CLASS['core_db']->sql_build_array('UPDATE', $sql_array) . ' 
							WHERE user_id = ' . $_CLASS['core_user']->data['user_id'];
                        $_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']);
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:67,代码来源:ucp_profile.php


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