[問題]預設頭像圖示

phpBB 2 MOD Support
無論是官方或非官方認證之外掛,安裝與使用問題討論。
(發表文章請按照公告格式發表,違者砍文)

版主: 版主管理群

主題已鎖定
andyexex
星球公民
星球公民
文章: 47
註冊時間: 2003-10-18 20:52
來自: 赤貫星

[問題]預設頭像圖示

文章 andyexex »

問題外掛:預設頭像圖示\r
使用版本:phpBB 2.0.2
網站位置:http://www.e104.org/~andyexex/phpBB2/
狀況描述:
我裝了預設頭像圖示後,似乎是usercp_viewprofile.php的問題
影響到了Mac版本的HP/MP/EXP(舊版,發生問題是所有人物的HP/MP/EXP全部變成0,而且職業、等級都無法顯示了),如下圖:
圖檔

裝過的MOD:
主題類型
會員上線狀態
虛擬貨幣
銀行、搶劫、樂透、英雄排行榜
網站推薦進階版
在個人詳細資料中顯示擁有財產
快速回覆進階版
Exobud MP播放器
TOP5主題
HP/MP/EXP
太空戰士線上遊戲
吉川拓也
竹貓忠實會員
竹貓忠實會員
文章: 1215
註冊時間: 2003-02-09 18:24
來自: [ G.I.T ]
聯繫:

Re: [問題]預設頭像圖示

文章 吉川拓也 »

似乎是usercp_viewprofile.php的問題
影響到了Mac版本的HP/MP/EXP(舊版,發生問題是所有人物的HP/MP/EXP全部變成0,而且職業、等級都無法顯示了),
知道是這部分問題就往這裡找= =
拆掉再重裝一次 . 邊改邊測試 . 就知道錯誤位置了~
善用 搜尋 可以解決您 90% 的問題
頭腦清晰,選擇正確。 (╯▔︹▔)╯~╘═╛
andyexex
星球公民
星球公民
文章: 47
註冊時間: 2003-10-18 20:52
來自: 赤貫星

文章 andyexex »

我試過了很多次,但是還是不知道該怎麼改,我是真的沒辦法才來竹貓發問的><",順便貼一下該MOD:

代碼: 選擇全部

################################################################# 
## Mod Title: Default Avatar MOD 
## Mod Version: 1.0.0 
## Author: Sven Ansem <sven@shannado.nl> - http://www.shannado.nl 
## Description: This MOD shows a default avatar for user who don't have set an avatar. The default avatar mus be set in 
## template config file. You can also specify an avatar for the guest user ! 
## 
## 
## 
## Installation Level: Easy 
## Installation Time: 5 
## Files To Edit: viewtopic.php, usercp_viewprofile.php, subSilver.cfg 
## Included Files: 
################################################################# 
## Security Disclaimer: This MOD Cannot Be Posted To Or Added At Any Non-Official phpBB Sites 
################################################################# 
## 
## Author Note: 
## Upload your default avatar pic into /template/subSilver/images !!!!!!!!! 
## 
## 
## History: 
## ------------ 
## 0.9.0 beta 
## - Beta 
## 
## 0.9.1 beta 
## - You can also specify an avatar for the guest user ! 
## 
## 1.0.0 Final 
## - Final Release 
################################################################# 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
################################################################# 



# 
#-----[ OPEN ]------------------------------------------ 
# 

viewtopic.php 


# 
#-----[ FIND ]------------------------------------------ 
# 






case USER_AVATAR_GALLERY: 
            $poster_avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : ''; 
            break; 
      } 
   } 






# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 







// 
   // Default Avatar MOD - Begin 
   // 
   if ( empty($poster_avatar) && $poster_id != ANONYMOUS) 
   { 
      $poster_avatar = '<img src="'.  $images['default_avatar'] .'" alt="" border="0" />'; 
   } 
   if ( $poster_id == ANONYMOUS ) 
   { 
      $poster_avatar = '<img src="'.  $images['guest_avatar'] .'" alt="" border="0" />'; 
   } 
   // 
   // Default Avatar MOD - End 
   // 






# 
#-----[ OPEN ]------------------------------------------ 
# 

includes/usercp_viewprofile.php 


# 
#-----[ FIND ]------------------------------------------ 
# 







case USER_AVATAR_GALLERY: 
         $avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : ''; 
         break; 
   } 
} 






# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 






// 
// Default Avatar MOD - Begin 
// 
if ( empty($avatar_img) ) 
{ 
   $avatar_img = '<img src="'.  $images['default_avatar'] .'" alt="" border="0" />'; 
}  
// 
// Default Avatar MOD - End 
// 







# 
#-----[ OPEN ]------------------------------------------ 
# 

templates/subSilver/subSilver.cfg 

# 
#-----[ FIND ]------------------------------------------ 
# 



$current_template_images = $current_template_path . "/images"; 









# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 



// 
// Default Avatar MOD 
// 
$images['default_avatar'] = "$current_template_images/no_avatar.gif"; 
$images['guest_avatar'] = "$current_template_images/guest_avatar.gif"; 





# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# Eom 
最後再把想要設定的頭像圖檔
no_avatar.gif...guest_avatar.gif....

放在templates/xxxxxx/images/...的資料夾裡面...完成

---------------------------[以下是我的usercp_viewprofile.php]--------------------

[php]<?php
/***************************************************************************
* usercp_viewprofile.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id: usercp_viewprofile.php,v 1.5 2002/03/31 00:06:34 psotfx Exp $
*
*
***************************************************************************/

/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
***************************************************************************/

if ( !defined('IN_PHPBB') )
{
die("Hacking attempt");
exit;
}

if ( empty($HTTP_GET_VARS[POST_USERS_URL]) || $HTTP_GET_VARS[POST_USERS_URL] == ANONYMOUS )
{
message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
}
$profiledata = get_userdata(intval($HTTP_GET_VARS[POST_USERS_URL]));

$sql = "SELECT *
FROM " . RANKS_TABLE . "
ORDER BY rank_special, rank_min";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain ranks information', '', __LINE__, __FILE__, $sql);
}

while ( $row = $db->sql_fetchrow($result) )
{
$ranksrow[] = $row;
}
$db->sql_freeresult($result);

//
// Output page header and profile_view template
//
$template->set_filenames(array(
'body' => 'profile_view_body.tpl')
);
make_jumpbox('viewforum.'.$phpEx);

//
// Calculate the number of days this user has been a member ($memberdays)
// Then calculate their posts per day
//
$regdate = $profiledata['user_regdate'];
$memberdays = max(1, round( ( time() - $regdate ) / 86400 ));
$posts_per_day = $profiledata['user_posts'] / $memberdays;

// Get the users percentage of total posts
if ( $profiledata['user_posts'] != 0 )
{
$total_posts = get_db_stat('postcount');
$percentage = ( $total_posts ) ? min(100, ($profiledata['user_posts'] / $total_posts) * 100) : 0;
}
else
{
$percentage = 0;
}

$avatar_img = '';
if ( $profiledata['user_avatar_type'] && $profiledata['user_allowavatar'] )
{
switch( $profiledata['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_REMOTE:
$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_GALLERY:
$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
break;
}
}//
// Default Avatar MOD - Begin
//
if ( empty($avatar_img) )
{
$avatar_img = '<img src="'. $images['default_avatar'] .'" alt="" border="0" />';
}
//
// Default Avatar MOD - End
//


if ($profiledata['user_robfail'] > 0)
{
$avatar_img .= '<br>';
$robid = floor(($profiledata['user_robfail'] - 1) / 4);
$robcnt = (($profiledata['user_robfail'] - 1) % 4) + 1;
for ($j=0; $j < $robcnt; $j++)
{
$avatar_img .= '<img src="images/rob' . $robid . '.gif" />';
}
$avatar_img .= '<br><span class="gensmall">笨~ 失敗的搶匪~</span>';
}
}

$poster_rank = '';
$rank_image = '';
if ( $profiledata['user_rank'] )
{
for($i = 0; $i < count($ranksrow); $i++)
{
if ( $profiledata['user_rank'] == $ranksrow[$i]['rank_id'] && $ranksrow[$i]['rank_special'] )
{
$poster_rank = $ranksrow[$i]['rank_title'];
$rank_image = ( $ranksrow[$i]['rank_image'] ) ? '<img src="' . $ranksrow[$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
}
}
}
else
{
for($i = 0; $i < count($ranksrow); $i++)
{
if ( $profiledata['user_posts'] >= $ranksrow[$i]['rank_min'] && !$ranksrow[$i]['rank_special'] )
{
$poster_rank = $ranksrow[$i]['rank_title'];
$rank_image = ( $ranksrow[$i]['rank_image'] ) ? '<img src="' . $ranksrow[$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
}
}
}

$temp_url = append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=" . $profiledata['user_id']);
$pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>';
$pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>';

if ( !empty($profiledata['user_viewemail']) || $userdata['user_level'] == ADMIN )
{
$email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL .'=' . $profiledata['user_id']) : 'mailto:' . $profiledata['user_email'];

$email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>';
$email = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>';
}
else
{
$email_img = ' ';
$email = ' ';
}

$www_img = ( $profiledata['user_website'] ) ? '<a href="' . $profiledata['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" border="0" /></a>' : ' ';
$www = ( $profiledata['user_website'] ) ? '<a href="' . $profiledata['user_website'] . '" target="_userwww">' . $profiledata['user_website'] . '</a>' : ' ';

if ( !empty($profiledata['user_icq']) )
{
$icq_status_img = '<a href="http://wwp.icq.com/' . $profiledata['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $profiledata['user_icq'] . '&img=5" width="18" height="18" border="0" /></a>';
$icq_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $profiledata['user_icq'] . '"><img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" title="' . $lang['ICQ'] . '" border="0" /></a>';
$icq = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $profiledata['user_icq'] . '">' . $lang['ICQ'] . '</a>';
}
else
{
$icq_status_img = ' ';
$icq_img = ' ';
$icq = ' ';
}

$aim_img = ( $profiledata['user_aim'] ) ? '<a href="aim:goim?screenname=' . $profiledata['user_aim'] . '&message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>' : ' ';
$aim = ( $profiledata['user_aim'] ) ? '<a href="aim:goim?screenname=' . $profiledata['user_aim'] . '&message=Hello+Are+you+there?">' . $lang['AIM'] . '</a>' : ' ';

$msn_img = ( $profiledata['user_msnm'] ) ? $profiledata['user_msnm'] : ' ';
$msn = $msn_img;

$yim_img = ( $profiledata['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $profiledata['user_yim'] . '&.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : '';
$yim = ( $profiledata['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $profiledata['user_yim'] . '&.src=pg">' . $lang['YIM'] . '</a>' : '';

$temp_url = append_sid("search.$phpEx?search_author=" . urlencode($profiledata['username']) . "&showresults=posts");
$search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['Search_user_posts'] . '" title="' . $lang['Search_user_posts'] . '" border="0" /></a>';
$search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';
include($phpbb_root_path . 'includes/level_mod.'.$phpEx); //added for Level Mod (Mac)


//
// Generate page
//
$page_title = $lang['Viewing_profile'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->assign_vars(array(
'USERNAME' => $profiledata['username'],
'JOINED' => create_date($lang['DATE_FORMAT'], $profiledata['user_regdate'], $board_config['board_timezone']),
'POSTER_RANK' => $poster_rank,
'RANK_IMAGE' => $rank_image,
'POSTS_PER_DAY' => $posts_per_day,
'POSTS' => $profiledata['user_posts'],
'PERCENTAGE' => $percentage . '%',
'POST_DAY_STATS' => sprintf($lang['User_post_day_stats'], $posts_per_day),
'POST_PERCENT_STATS' => sprintf($lang['User_post_pct_stats'], $percentage),

'SEARCH_IMG' => $search_img,
'SEARCH' => $search,
'PM_IMG' => $pm_img,
'PM' => $pm,
'EMAIL_IMG' => $email_img,
'EMAIL' => $email,
'WWW_IMG' => $www_img,
'WWW' => $www,
'ICQ_STATUS_IMG' => $icq_status_img,
'ICQ_IMG' => $icq_img,
'ICQ' => $icq,
'AIM_IMG' => $aim_img,
'AIM' => $aim,
'MSN_IMG' => $msn_img,
'MSN' => $msn,
'YIM_IMG' => $yim_img,
'YIM' => $yim,

'LOCATION' => ( $profiledata['user_from'] ) ? $profiledata['user_from'] : ' ',
'OCCUPATION' => ( $profiledata['user_occ'] ) ? $profiledata['user_occ'] : ' ',
'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : ' ',
'AVATAR_IMG' => $avatar_img,
'USER_MONEY' => $profiledata['user_money'], // Virtual_Money_MOD
'L_USER_MONEY' => $lang['Virtual_Money'], // Virtual_Money_MOD
'USER_BANK' => $profiledata['user_bank'], // Virtual_Bank_MOD
'L_USER_BANK' => $lang['Virtual_Bank'], // Virtual_Bank_MOD

'L_VIEWING_PROFILE' => sprintf($lang['Viewing_user_profile'], $profiledata['username']),
'L_ABOUT_USER' => sprintf($lang['About_user'], $profiledata['username']),
'L_AVATAR' => $lang['Avatar'],
'L_POSTER_RANK' => $lang['Poster_rank'],
'L_JOINED' => $lang['Joined'],
'L_TOTAL_POSTS' => $lang['Total_posts'],
'L_SEARCH_USER_POSTS' => sprintf($lang['Search_user_posts'], $profiledata['username']),
'L_CONTACT' => $lang['Contact'],
'L_EMAIL_ADDRESS' => $lang['Email_address'],
'L_EMAIL' => $lang['Email'],
'L_PM' => $lang['Private_Message'],
'L_ICQ_NUMBER' => $lang['ICQ'],
'L_YAHOO' => $lang['YIM'],
'L_AIM' => $lang['AIM'],
'L_MESSENGER' => $lang['MSNM'],
'L_WEBSITE' => $lang['Website'],
'L_LOCATION' => $lang['Location'],
'L_OCCUPATION' => $lang['Occupation'],
'L_INTERESTS' => $lang['Interests'],

'U_SEARCH_USER' => append_sid("search.$phpEx?search_author=" . urlencode($profiledata['username'])),
/* BEGIN LEVEL MOD */
'HP' => $level_hp,
'HP_WIDTH' => $level_hp_percent,
'HP_EMPTY' => ( 100 - $level_hp_percent ),
'MP' => $level_mp,
'MP_WIDTH' => $level_mp_percent,
'MP_EMPTY' => ( 100 - $level_mp_percent ),
'EXP' => $level_exp,
'EXP_WIDTH' => $level_exp_percent,
'EXP_EMPTY' => ( 100 - $level_exp_percent ),
'LEVEL' => $level_level,
'LEVEL_CLASSNAME' => $level_classname,
'LEVEL_SKILLRATIO' => $level_skillratio,
/* END LEVEL MOD */



'S_PROFILE_ACTION' => append_sid("profile.$phpEx"))
);

$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>[/php]

附註:我的風格是FIapple
麻煩ㄌ :-o
主題已鎖定

回到「外掛問題討論」