Face for phpBB3 (虛擬形象) Ver 1.0

MODs Released by Other phpbb Sites
歡迎推薦非官方認證外掛,或許有安全性之疑慮,所有問題由原發表者回覆!

版主: 版主管理群譯文組

版面規則
所謂「非官方認證外掛」是指未經官方認證,發表在 [3.0.x] MODs in Development 版面的外掛。

為了維護推薦外掛之品質,自即日起,如果要在這個版面推薦外掛,那麼請遵守底下格式,謝謝合作!

發文格式:
  • 外掛名稱:(原文/中文化名稱)
  • 外掛作者:(原文)
  • 外掛描述:(原文/中文化描述)
  • 外掛版本:(原文)
  • 外掛下載:(連結位址)
  • 資料來源:(連結位址)
    --
  • 中文化分享:(若外掛無須修改語言檔、或無須上傳語言檔,則免之。)
    --
  • 使用後心得:(簡單陳述您的安裝經驗、使用心得、或其他注意事項。)


p.s.
這個版面之發文,需經版主審核。
主題已鎖定
ETERNAL
星球公民
星球公民
文章: 297
註冊時間: 2002-01-23 11:23

Face for phpBB3 (虛擬形象) Ver 1.0

文章 ETERNAL »

外掛名稱:Face for phpBB3 (虛擬形象)
外掛作者:ETERNAL
外掛描述:讓您的論壇會員可以使用虛擬形象。
外掛版本:1.0
外掛下載: 資料來源:http://www.et99.net/

--
作者留言:

前言:

這功能是2003年時期的作品,當時改自飄在北京以及CTB,只支援phpBB2跟vbb

一週前提起動力,改成支援phpBB3

由於phpBB3與phpBB2差異頗大,花了些時間了解phpBB3的設計架構

很高興phpBB進步很多,但感覺開發mod上,難度提高不少(或許是我個人不能適應這種改變)

這版的虛擬形象功能上做了異動及移除
  • 拍賣(移除)
  • 收藏(移除)
  • 貨幣改成文章數
  • 使用期限(移除)
  • 後台(移除)
  • 圖片替換成CTB
只支援prosilver風格,其他風格請自行修改

注意: 此mod有許多地方,沒有按照phpBB3的規範來製作,不適合做為開發mod參考及範例

--
Demo(演示):
http://www.et99.net/face.php
QQ截圖未命名.png
--
安裝方法:
解壓縮face_for_phpbb3.rar
解壓縮face_img.rar
copy: face.php
to: face.php
copy: facealbum.php
to: facealbum.php
copy: facebuy.php
to: facebuy.php
copy: facedata.php
to: facedata.php
copy: style/prosilver/template/face_album.html
to: style/prosilver/template/face_album.html
copy: style/prosilver/template/face_body.html
to: style/prosilver/template/face_body.html
copy: style/prosilver/template/face_center.html
to: style/prosilver/template/face_center.html
copy: style/prosilver/template/face_left.html
to: style/prosilver/template/face_left.html
copy: style/prosilver/template/face_view.html
to: style/prosilver/template/face_view.html
copy: style/prosilver/template/face_ctb_js.js
to: style/prosilver/template/face_ctb_js.js
copy: style/prosilver/template/face_ctb_js2.js
to: style/prosilver/template/face_ctb_js2.js
copy: images/*.*
to: images/*.*

解壓縮face_sql.rar
import face_sql.sql to database

open
viewtopic.php
find

代碼: 選擇全部

// Posts are stored in the $rowset array while $attach_list, $user_cache
// and the global bbcode_bitfield are built
after add

代碼: 選擇全部

// face_show BEGIN
$poster_list=array();
$poster_sex_list=array();
// face_show END
find

代碼: 選擇全部

	// Set max_post_time
	if ($row['post_time'] > $max_post_time)
before add

代碼: 選擇全部

	// face_show BEGIN
	if($row['user_avatar_type']==AVATAR_SHOW)
	{
		$poster_list[$row['poster_id']] = (int) $row['poster_id'];
	}
	// face_show END
find

代碼: 選擇全部

				'avatar'			=> ($user->optionget('viewavatars')) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']) : '',
				'age'			=> '',
replace

代碼: 選擇全部

				'avatar'			=> ($user->optionget('viewavatars')) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height'],'USER_AVATAR',false, $row['poster_id']) : '',
				'age'			=> '',
find

代碼: 選擇全部

		$cp_row = (isset($profile_fields_cache[$poster_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$poster_id]) : array();
replace

代碼: 選擇全部

		// face_show BEGIN
		if(isset($profile_fields_cache[$poster_id]))
		{
			$cp_row=$cp->generate_profile_fields_template('show', false, $profile_fields_cache[$poster_id]);
			if(array_key_exists("sex",$profile_fields_cache[$poster_id]))
			{
				if($profile_fields_cache[$poster_id]['sex']['value']==1)
				{
					$poster_sex_list[$poster_id]="m";
				}elseif($profile_fields_cache[$poster_id]['sex']['value']==2)
				{
					$poster_sex_list[$poster_id]="f";
				}
			}
		}else
		{
			$cp_row=array();
		}
		// face_show END
find

代碼: 選擇全部

unset($rowset, $user_cache);
after add

代碼: 選擇全部

// face_show BEGIN
if(count($poster_list)>0)
{
	$sql="SELECT id,userid,classid,facepicid,face_fitherd FROM week9_userdata where userid in (".implode(",",$poster_list).") and dafaultuse = '1' order by userid";
	$face = $db->sql_query($sql);
	$face_array = array();
	while ($faces = $db->sql_fetchrow($face))
	{
		if($poster_sex_list[$faces["userid"]]!=$faces["face_fitherd"] && ($faces["face_fitherd"] != 't'))
		{
			$db->sql_query("UPDATE week9_userdata SET dafaultuse = '0'
							where id = ".$faces["id"]." and classid = '$faces[classid]' and facepicid = '$faces[facepicid]' 
							 ");
		}else
		{
			$face_array[$faces["userid"]][$faces["classid"]] = $faces["facepicid"];
		}
	}
	$db->sql_freeresult($face);
	foreach($poster_list as $k=>$v)
	{
		$tempequip = '0-0-0-0-0-0-0-0-init-init-0-init-0-init-init-0-0-0-init-0-0-0-0-0-0-0';  //男性的初始值
		if ($poster_sex_list[$v] == "m")
		{
			$tempequip = '0-0-0-0-0-0-0-0-init-init-0-init-0-init-init-0-0-0-init-0-0-0-0-0-0-0';  //男性的初始值
		}
		elseif($poster_sex_list[$v] == "f")
		{
			$tempequip = '0-0-0-0-0-0-0-0-initf-initf-0-initf-0-initf-initf-0-0-0-initf-0-0-0-0-0-0-0'; //女性的初始值
		}
		$cookiearray = explode('-', $tempequip);
		if(count($face_array[$v])>0)
		{
			foreach($face_array[$v] as $k1=>$v1)
			{
				$cookiearray[$k1] = $v1;
			}
		}
		$face_array[$v]["show"]=implode("-", $cookiearray);
		$template->assign_block_vars('face', array(
				'FACE_SHOW'	=> $face_array[$v]["show"],
				'UID'		=> $v
				)
			);
	}
}
unset($face_array,$cookiearray,$usercaifu,$poster_sex_list,$poster_list);
// face_show END
open
/includes/constants.php
find

代碼: 選擇全部

define('AVATAR_GALLERY', 3);
after add

代碼: 選擇全部

define('AVATAR_SHOW', 4);
open
/includes/functions_display.php
find

代碼: 選擇全部

function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR', $ignore_config = false)
replace

代碼: 選擇全部

function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR', $ignore_config = false,$uid=0)
find

代碼: 選擇全部

empty($avatar)
replace

代碼: 選擇全部

(empty($avatar) && $avatar_type!=AVATAR_SHOW)
find

代碼: 選擇全部

		case AVATAR_REMOTE:
			if (!$config['allow_avatar_remote'] && !$ignore_config)
			{
				return '';
			}
		break;
after add

代碼: 選擇全部

		case AVATAR_SHOW:
			return '<DIV name="Show'.$uid.'" id="Show'.$uid.'" style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; LEFT: 0px; PADDING-BOTTOM: 0px; WIDTH: 120px; PADDING-TOP: 0px; POSITION: relative; TOP: 0px; HEIGHT: 150px;"></DIV>';
		break;
open
/includes/functions_user.php
find

代碼: 選擇全部

	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;
	}
after add

代碼: 選擇全部

else if(isset($_POST['face']))
	{
		if($_POST['face']=="1"){$sql_ary['user_avatar_type'] = AVATAR_SHOW;}
	}
open
includes/ucp/ucp_profile.php
find

代碼: 選擇全部

				{
					$error[] = $user->lang['AVATAR_TYPE_NOT_ALLOWED'];
				}
after add

代碼: 選擇全部

				// Custom Profile Fields
				$profile_fields = array();
				$user_id=$user->data['user_id'];
				if ($config['load_cpf_viewprofile'])
				{
					include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
					$cp = new custom_profile();
					$profile_fields = $cp->generate_profile_fields_template('grab', $user_id);
					// face_show BEGIN
					if(isset($profile_fields[$user_id]))
					{
						if(array_key_exists("sex",$profile_fields[$user_id]))
						{
							if($profile_fields[$user_id]['sex']['value']==1)
							{
								$sex=1;
							}elseif($profile_fields[$user_id]['sex']['value']==2)
							{
								$sex=2;
							}
						}
					}
					// face_show END
					$profile_fields = (isset($profile_fields[$user_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields[$user_id]) : array();
				}
				// face_show BEGIN
				if($user->data['user_avatar_type']==AVATAR_SHOW)
				{
					$tempequip = '0-0-0-0-0-0-0-0-init-init-0-init-0-init-init-0-0-0-init-0-0-0-0-0-0-0';  //男性的初始值
					if ($sex == 1)
					{
						$tempequip = '0-0-0-0-0-0-0-0-init-init-0-init-0-init-init-0-0-0-init-0-0-0-0-0-0-0';  //男性的初始值	
					}
					elseif($sex == 2)
					{
						$tempequip = '0-0-0-0-0-0-0-0-initf-initf-0-initf-0-initf-initf-0-0-0-initf-0-0-0-0-0-0-0'; //女性的初始值	
					}
					$cookiearray = explode('-', $tempequip);
					$facecookie = $db->sql_query("SELECT classid,facepicid FROM week9_userdata where userid = ".$user_id." and dafaultuse = '1'");
					while ($usercaifu = $db->sql_fetchrow($facecookie))
					{
						$cookiearray[$usercaifu["classid"]] = $usercaifu["facepicid"];
					}
					$db->sql_freeresult($facecookie);
					$tempequip = implode("-", $cookiearray);
				}
				// face_show END
find

代碼: 選擇全部

					'L_AVATAR_EXPLAIN'	=> sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024),
after add

代碼: 選擇全部

					// face_show BEGIN
					'FACE'				=> ($user->data['user_avatar_type']==AVATAR_SHOW)?true:false,
					'UID'				=> 0,
					'FACE_SHOW'			=> $tempequip
					// face_show END
open
memberlist.php
find

代碼: 選擇全部

			$profile_fields = $cp->generate_profile_fields_template('grab', $user_id);
after add

代碼: 選擇全部

			// face_show BEGIN
			if(isset($profile_fields[$user_id]))
			{
				if(array_key_exists("sex",$profile_fields[$user_id]))
				{
					if($profile_fields[$user_id]['sex']['value']==1)
					{
						$sex=1;
					}elseif($profile_fields[$user_id]['sex']['value']==2)
					{
						$sex=2;
					}
				}
			}
			// face_show END
find

代碼: 選擇全部

		else
		{
			$member['posts_in_queue'] = 0;
		}
after add

代碼: 選擇全部

		// face_show BEGIN
		if($member['user_avatar_type']==AVATAR_SHOW)
		{
			if ($sex == 1)
			{
				$tempequip = '0-0-0-0-0-0-0-0-init-init-0-init-0-init-init-0-0-0-init-0-0-0-0-0-0-0';  //男性的初始值	
			}
			elseif($sex == 2)
			{
				$tempequip = '0-0-0-0-0-0-0-0-initf-initf-0-initf-0-initf-initf-0-0-0-initf-0-0-0-0-0-0-0'; //女性的初始值	
			}
			$cookiearray = explode('-', $tempequip);
			$facecookie = $db->sql_query("SELECT classid,facepicid FROM week9_userdata where userid = ".$user_id." and dafaultuse = '1'");
			while ($usercaifu = $db->sql_fetchrow($facecookie))
			{
				$cookiearray[$usercaifu["classid"]] = $usercaifu["facepicid"];
			}
			$db->sql_freeresult($facecookie);
			$tempequip = implode("-", $cookiearray);
		}
		// face_show END
find

代碼: 選擇全部

			'U_REMOVE_FOE'		=> ($foe && $foes_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&mode=foes&usernames[]=' . $user_id) : '',
after add

代碼: 選擇全部

			// face_show BEGIN
			'FACE'				=> ($member['user_avatar_type']==AVATAR_SHOW)?true:false,
			'UID'				=> 0,
			'FACE_SHOW'			=> $tempequip
			// face_show END

open
/styles/prosilver/template/viewtopic_body.html
find

代碼: 選擇全部

<!-- INCLUDE overall_header.html -->
after add

代碼: 選擇全部

<script type="text/javascript" src="{T_TEMPLATE_PATH}/face_ctb_js.js"></script>
find

代碼: 選擇全部

<!-- INCLUDE overall_footer.html -->
before add

代碼: 選擇全部

<script type="text/javascript">
<!-- BEGIN face -->
	var currface="{face.FACE_SHOW}";
	start_face({face.UID});
<!-- END face -->
</script>
open
/styles/prosilver/template/ucp_avatar_options.html
find

代碼: 選擇全部

<div class="panel">
before add

代碼: 選擇全部

<script type="text/javascript" src="{T_TEMPLATE_PATH}/face_ctb_js.js"></script>
find

代碼: 選擇全部

	</fieldset>

	<!-- IF S_IN_AVATAR_GALLERY -->
before add

代碼: 選擇全部

		<dl>
			<dt><label for="yes">是否使用虛擬形象:</label><br /><span>是否使用<a href="face.php">形象中心</a>的造型做為頭像?<br />使用後若欲關閉,請勾選刪除圖片。</span></dt>
			<dd>
				<label for="yes"><input type="checkbox" name="face" id="yes" value="1" class="inputbox autowidth" /> 是</label> &nbsp;&nbsp; 
			</dd>
		</dl>
find

代碼: 選擇全部

	<span class="corners-bottom"><span></span></span></div>
</div>
after add

代碼: 選擇全部

<!-- IF FACE -->
	<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
	var currface="{FACE_SHOW}";
	start_face({UID});
	</script>
<!-- ENDIF FACE -->
open
/styles/prosilver/template/memberlist_view.html
find

代碼: 選擇全部

<!-- INCLUDE overall_header.html -->
after add

代碼: 選擇全部

<script type="text/javascript" src="{T_TEMPLATE_PATH}/face_ctb_js.js"></script>
find

代碼: 選擇全部

<!-- INCLUDE jumpbox.html -->
before add

代碼: 選擇全部

<!-- IF FACE -->
	<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
	var currface="{FACE_SHOW}";
	start_face({UID});
	</script>
<!-- ENDIF FACE -->
open
/language/zh_cmn_hant/common.php
find

代碼: 選擇全部

	'AVATAR_WRONG_SIZE'	=> '頭像的寬度必須大於 %1$d 像素,高度必須大於 %2$d 像素,並且寬度不得超過 %3$d 像素,高度不得超過 %4$d 像素。您送出的頭像寬為 %5$d 像素,高為 %6$d 像素。',
after add

代碼: 選擇全部

	'AVATAR_PAGE'		=> '虛擬形象',
在管理員控制台新增性別欄位
欄位類型: 下拉選單
欄位定義: sex
公開地顯示個人資料欄位: 是
看得見的選項 (可複選)在會員控制台中顯示: 勾選
顯示在註冊的頁面: 勾選
顯示在文章頁面: 勾選
必填欄位: 勾選
輸入(請依序輸入):
男生
女生
未知
選項無輸入時等值: 請選擇未知
管理員控制台
管理員控制台
將「在主題頁面中顯示自訂個人資料欄位」設定為「是」
2010-12-24_112045.png
close / finish

進入形象中心連結入口 /face.php

--
更新記錄:
最後由 ETERNAL 於 2010-12-24 14:16 編輯,總共編輯了 7 次。
水色論壇 http://www.et99.net
簡德賢分享
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8510
註冊時間: 2004-04-30 01:54
來自: Taiwan

Re: Face for phpBB3 (虛擬形象) Ver 1.0

文章 心靈捕手 »

很高興看到您對 phpBB 的熱情依舊! (:Y)

替您發表一個主題「[討論] Face for phpBB3 (虛擬形象)」,請勿見怪!
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
主題已鎖定

回到「[3.0.x] 非官方認證外掛」