1 頁 (共 1 頁)

[外掛] Complete banner mod

發表於 : 2003-11-24 16:28
chadav
這個 mod 可以讓你的 phpbb 內加入 banners 廣告管理統, 並決定 banner 顯示的地方或版面, 甚至只給哪些會員看的!!

下載地方 http://mods.db9.dk/viewforum.php?f=55

自個兒注意看有無最新版本喔!! 最後附上正體中文語系!!

代碼: 選擇全部

######################################################## 
## MOD Title:        Complete banner mod
## MOD Author:       Niels Chr. R鷣 Denmark < ncr@db9.dk > http://mods.db9.dk
##
## MOD Description:  This mod makes it posible to add banners to your phpbb2 pages, by default banners are placed in top/button but you may place the tags, inside any template file.
##                   I have given a example with 15 banner placements, you may add more in the language file, if you need others the text in the language file are only examples, you may change it.
##                   you may add banners, and define priority and time/day/date based rules, to let banners rotate you may also specify who may/shall see the banners, e.g. guest only or not admin
##                   number of clicks and views are counted, and can be viewed in ACP
##
## MOD Version:      1.1.4
## Compability:	     2.0.0->2.0.6 
## 
## Installation Level:  Easy 
## Installation Time:   10-15 Minutes (1mn by EasyMOD of Nuttzy)
##
## Files To Edit: 10
##	viewonline.php
##	includes/page_header.php
##	includes/page_tail.php
##	includes/constants.php
##	admin/admin_db_utilities.php
##	templates/subSilver/overall_header.tpl
##	templates/subSilver/viewtopic_body.tpl
##	templates/subSilver/viewforum_body.tpl
##	templates/subSilver/overall_footer.tpl
##
## Included Files: 6
##	redirect.php
##	admin/admin_banner.php
##	language/lang_english/lang_banner.php
##	templates/subSilver/redirect.tpl
##	templates/subSilver/admin/banner_list_body.tpl
##	templates/subSilver/admin/banner_edit_body.tpl
##
##
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes: 
## 
## For updates, check this official links...
## http://mods.db9.dk/viewforum.php?f=55
##
## This MOD is compatible and can be installed by EasyMOD
## of Nuttzy (but is not officially EasyMOD Compliant)!
## http://www.phpbb.com/phpBB/viewtopic.php?t=124436
##
## However, on alpha releases of EM SQL commands are not performed!
## Then, meanwhile beta or final release (with DB alterations
## capabilities), you must update your database manually by
## copying the complete_banner_db_update.php file in your phpBB
## root directory, execute it with your navigator and after,
## delete it.
##
## In any case, if you install this MOD manually or using an
## alpha release of EM, please run this file NOW, before
## editing phpBB files by EM or manually!!!
## Otherwise, you may have an error message during your next
## connection.
##
## Moreover, because EM 0.0.10a can not already manage actions
## for not necessarily existing language, the other language(s)
## modifications provided with this MOD can not be automatically
## installed. So, if you need other language(s), copy the
## lang_banner.php file(s) manually from their languages
## sub-directories in root/language/, if available of course.
##
##
############################################################## 
## MOD History: 
##
##   2003-10-25 - version 1.1.4
##	- minor change redirect.php
##	- added PAGE_REDIRECT constant
##	- added change to viewonline.php
##	- corrected how-to header
##	- updated lang_banner.php
##
##   2003-10-25 - version 1.1.3
##	- added change to admin_db_utils.php
##
##   2003-08-23 - Version 1.1.2
##	- updated redirect.php, db_update.php and constants.php - click statistics are now stored
##
##   2003-08-23 - Version 1.1.1
##	- updated admin_banner.php, and improved the template/lang_banner.php
##
##   2003-08-23 - Version 1.1.0
##	- now EM ready
##
##   ????-??-?? - Version 1.0.5.
##	- admin_banner.php, redirect.php updated 
##
##   ????-??-?? - Version 1.0.4.
##	- minor typo in the file names, now corrected
##
##   ????-??-?? - Version 1.0.3.
##	- 1.0.2. did require change to page_tail.php - witch is now included
##
##   ????-??-?? - Version 1.0.2.
##	- now support that banner are to show in a specific forum
##
##   ????-??-?? - Version 1.0.1.
##	- added new feature, banners can show depending on user type
##
##   ????-??-?? - Version 1.0.0.
##	- corrected redirect.tpl file, now considered as final
##
##   ????-??-?? - Version 0.9.3.
##	- correction to page_header.php
##
##   ????-??-?? - Version 0.9.2.
##	- correction to page_header.php
##
##   ????-??-?? - Version 0.9.1.
##	- correction to page_header.php
##
##   ????-??-?? - Version 0.9.1.
##	- correction to page_header.php
##
##   ????-??-?? - Version 0.9.0. 
##	- initial beta  
##
##
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
##############################################################

# 
#-----[ SQL ]------------------------------------------ 
# 
# If you use an alpha release of EasyMOD, this instructions will not be executed!
# Please read author notes to update your database.
#
copy complete_banner_db_update.php to complete_banner_db_update.php
execute complete_banner_db_update.php
delete complete_banner_db_update.php

# 
#-----[ OPEN ]------------------------------------------
# 
viewonline.php

# 
#-----[ FIND ]------------------------------------------ 
# 
default:
$location = $lang['Forum_index'];

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
case PAGE_REDIRECT: 
	require_once($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_banner.' . $phpEx);

	if ($row['session_topic'])
	{
		$sql = "SELECT banner_description FROM " . BANNERS_TABLE . " WHERE banner_id=" . $row['session_topic'];
		if ( $result2 = $db->sql_query($sql) )
		{
			$banner_data = $db->sql_fetchrow($result2);
		}
		else
		{	
			message_die(GENERAL_ERROR, 'Could not obtain redirect online information', '', __LINE__, __FILE__, $sql);
		}
		$location_url = append_sid("redirect.$phpEx?banner_id=" . $row['session_topic']);
		$location = $lang['Left_via_banner'] .' --> '.$banner_data['banner_description'];
	} else
	{
		$location_url = "";
		$location = $lang['Left_via_banner'];
	}
	break;

# 
#-----[ OPEN ]------------------------------------------
# 
includes/constants.php

# 
#-----[ FIND ]------------------------------------------ 
# 
define('PAGE_GROUPCP', -11);

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
define('PAGE_REDIRECT', -1031);

# 
#-----[ FIND ]------------------------------------------ 
# 
define('USERS_TABLE', $table_prefix.'users');

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
define('BANNER_STATS_TABLE', $table_prefix.'banner_stats');
define('BANNERS_TABLE', $table_prefix.'banner');

# 
#-----[ OPEN ]------------------------------------------
# 
includes/page_header.php

# 
#-----[ FIND ]------------------------------------------ 
# 
//
// The following assigns all _common_ variables that may be used at any point

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
$time_now=time();
$hour_now=create_date('Hi',$time_now,$board_config['board_timezone']);
$date_now=create_date('Ymd',$time_now,$board_config['board_timezone']);
$week_now=create_date('w',$time_now,$board_config['board_timezone']);
$sql_level= ($userdata['user_id']==ANONYMOUS) ? ANONYMOUS : (($userdata['user_level']==ADMIN) ? MOD : (($userdata['user_level']==MOD) ? ADMIN : $userdata['user_level'])); 
$sql = "SELECT DISTINCT banner_id, banner_name, banner_spot, banner_description, banner_forum FROM ".BANNERS_TABLE ."
		WHERE banner_active
		AND IF(banner_level_type,IF(banner_level_type=1,'".$sql_level."'<=banner_level,IF(banner_level_type=2,'".$sql_level."'>=banner_level,'".$sql_level."'<>banner_level)),banner_level='".$sql_level."')
		AND (banner_timetype='0' 
		OR (( $hour_now BETWEEN time_begin AND time_end) AND ((banner_timetype='2'
		OR (( $week_now BETWEEN date_begin AND date_end) AND banner_timetype='4')
		OR (( $date_now BETWEEN date_begin AND date_end) AND banner_timetype='6')
		)))) ORDER BY banner_spot,SUBSTRING(RAND(),6,2)*banner_weigth";
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, "Couldn't get banners data", "", __LINE__, __FILE__, $sql);
} 
$banners = array();
$i=0;
while ($banners[$i] = $db->sql_fetchrow($result))
{
	$banner_spot=$banners[$i]['banner_spot'];
	if ($banner_spot<>$last_spot  AND ($banners[$i]['banner_forum']==$forum_id || !$banners[$i]['banner_forum']))
	{
		$template->assign_var('BANNER_'.$banner_spot.'_IMG', '<a href="'.append_sid('redirect.'.$phpEx.'?banner_id='.$banners[$i]['banner_id']).'" target="_blank"><img src="'.$banners[$i]['banner_name'].'" border="0" alt="'.$banners[$i]['banner_description'].'" title="'.$banners[$i]['banner_description'].'"></a>');
		$banner_show_list.= ', '.$banners[$i]['banner_id'];
	}
	$last_spot = ($banners[$i]['banner_forum']==$forum_id || !$banners[$i]['banner_forum']) ? $banner_spot : $last_spot;
	$i++;
}

# 
#-----[ OPEN ]------------------------------------------
# 
includes/page_tail.php

# 
#-----[ FIND ]------------------------------------------ 
# 
	die('Hacking attempt');
}

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
if ($banner_show_list)
{
	$banner_show_list['0'] = ($banner_show_list) ? ' ':'';
	$sql = "UPDATE ".BANNERS_TABLE." SET banner_view=banner_view+1 where banner_id IN ($banner_show_list)"; 
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, "Couldn't update banners data", "", __LINE__, __FILE__, $sql);
	} 
}

# 
#-----[ OPEN ]------------------------------------------ 
# 
admin/admin_db_utilities.php

# 
#-----[ FIND ]------------------------------------------ 
#
$tables = array(

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
$tables[] = 'banner';
$tables[] = 'banner_stats';

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/overall_header.tpl

# 
#-----[ FIND ]------------------------------------------ 
# 
<a name="top"></a>

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
\n# 
<!-- Banners -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="100%" colspan="3"><div align="center">{BANNER_0_IMG}</div></td>
  </tr>
  <tr>
    <td width="20%">
	 <table width="100%" border="0" cellspacing="2" cellpadding="2">
		<tr><td><div align="center">{BANNER_1_IMG}</div></td></tr>
		<tr><td><div align="center">{BANNER_2_IMG}</div></td></tr>
	</table>
    </td>
    <td width="60%">
	 <table width="100%" border="0" cellspacing="2" cellpadding="2">
		<tr><td><div align="center">{BANNER_3_IMG}</div></td></tr>
		<tr><td><div align="center">{BANNER_4_IMG}</div></td></tr>
	</table>
    </td>
    <td width="20%">
	 <table width="100%" border="0" cellspacing="2" cellpadding="2">
		<tr><td><div align="center">{BANNER_5_IMG}</div></td></tr>
		<tr><td><div align="center">{BANNER_6_IMG}</div></td></tr>
	</table>
    </td>
  </tr>
</table>
<!-- End Banners -->

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/overall_footer.tpl

# 
#-----[ FIND ]------------------------------------------ 
# 
	</tr>
</table>

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
<!-- Banners -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="20%">
	 <table width="100%" border="0" cellspacing="2" cellpadding="2">
		<tr><td><div align="center">{BANNER_7_IMG}</div></td></tr>
		<tr><td><div align="center">{BANNER_8_IMG}</div></td></tr>
	</table>
    </td>
    <td width="60%">
	 <table width="100%" border="0" cellspacing="2" cellpadding="2">
		<tr><td><div align="center">{BANNER_9_IMG}</div></td></tr>
		<tr><td><div align="center">{BANNER_10_IMG}</div></td></tr>
	</table>
    </td>
    <td width="20%">
	 <table width="100%" border="0" cellspacing="2" cellpadding="2">
		<tr><td><div align="center">{BANNER_11_IMG}</div></td></tr>
		<tr><td><div align="center">{BANNER_12_IMG}</div></td></tr>
	</table>
    </td>
  </tr>
</table>
<!-- End Banners -->

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/viewforum_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
# 
<b>{PAGINATION}</b>

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
{BANNER_13_IMG}<br/>

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/viewtopic_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
# 
<b>{PAGINATION}</b>

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
{BANNER_14_IMG}<br/>

# 
#-----[ FIND ]------------------------------------------ 
# 
<td width="40%" valign="top" nowrap="nowrap" align="left"><span class="gensmall">{S_WATCH_TOPIC}

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
<td align="left" valign="bottom" colspan="2">{BANNER_15_IMG}</td>

# 
#-----[ COPY ]------------------------------------------ 
# 
copy root/language/lang_english/lang_banner.php to language/lang_english/lang_banner.php
copy root/admin/admin_banner.php to admin/admin_banner.php
copy root/redirect.php to redirect.php
copy root/templates/subSilver/redirect.tpl to templates/subSilver/redirect.tpl
copy root/templates/subSilver/admin/banner_list_body.tpl to templates/subSilver/admin/banner_list_body.tpl
copy root/templates/subSilver/admin/banner_edit_body.tpl to templates/subSilver/admin/banner_edit_body.tpl

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 

# EoM


正體中文語系取自 plus1.3 內的檔案

[php]<?php
<?php
/***************************************************************************
* lang_banner.php [正體中文語系]
* -------------------
* begin : Thursday, March 13, 2003
* by : phpbb-tw 譯文組 phpBB-tw Team
* members 組員介紹 : http://phpbb-tw.net/phpbb/groupcp.php?g=13226
*
****************************************************************************/

// this is the text showen in admin panel, depending on your template layout,
// you may change the text, so this reflect the placement in the templates
// these are only exampels, you may add more or remove some of them.

$lang['Banner_spot']['0'] = "廣告在頁頂"; // used for {BANNER_0_IMG} tag in the template files
$lang['Banner_spot']['1'] = "左上 1"; // used for {BANNER_1_IMG} tag in the template files
$lang['Banner_spot']['2'] = "左上 2"; // used for {BANNER_2_IMG} tag in the template files
$lang['Banner_spot']['3'] = "頂部中心 1"; // used for {BANNER_3_IMG} tag in the template files
$lang['Banner_spot']['4'] = "頂部中心 2"; // used for {BANNER_4_IMG} tag in the template files
$lang['Banner_spot']['5'] = "右上 1"; // used for {BANNER_5_IMG} tag in the template files
$lang['Banner_spot']['6'] = "右上 2"; // used for {BANNER_6_IMG} tag in the template files
$lang['Banner_spot']['7'] = "左下 1"; // used for {BANNER_7_IMG} tag in the template files
$lang['Banner_spot']['8'] = "左下 2"; // used for {BANNER_8_IMG} tag in the template files
$lang['Banner_spot']['9'] = "底部中心 1"; // used for {BANNER_9_IMG} tag in the template files
$lang['Banner_spot']['10'] = "底部中心 2"; // used for {BANNER_10_IMG} tag in the template files
$lang['Banner_spot']['11'] = "右下 1"; // used for {BANNER_11_IMG} tag in the template files
$lang['Banner_spot']['12'] = "右下 2"; // used for {BANNER_12_IMG} tag in the template files
$lang['Banner_spot']['13'] = "觀看版面的最頂"; // used for {BANNER_13_IMG} tag in the template files
$lang['Banner_spot']['14'] = "觀看文章的最頂"; // used for {BANNER_14_IMG} tag in the template files
$lang['Banner_spot']['15'] = "觀看文章的最底"; // used for {BANNER_15_IMG} tag in the template files
$lang['Banner_spot']['16'] = "論壇入口 1"; // used for {BANNER_16_IMG} tag in the template files
$lang['Banner_spot']['17'] = "論壇入口 2"; // used for {BANNER_17_IMG} tag in the template files
$lang['Banner_spot']['18'] = "論壇入口 3"; // used for {BANNER_18_IMG} tag in the template files
$lang['Banner_spot']['19'] = "論壇入口 4"; // used for {BANNER_18_IMG} tag in the template files

//
// please do not modify the text below (except if you are translating)
//
$lang['Banner_title'] = "廣告管理控制台";
$lang['Banner_text'] = "在這個控制面板裡, 你可以管理這站上的廣告, 也可以設定廣告的有效時間";
$lang['Add_new_banner'] = "新廣告";
$lang['Banner_add_text'] = "這裡你可以增加/編輯廣告";

$lang['Banner_name'] = "圖片";
$lang['Banner_name_explain'] = "連結路徑可使用相對於phpBB2的路徑或者使用絕對路徑";
$lang['Banner_activated'] = "啟動";
$lang['Banner_activate'] = "啟動廣告";
$lang['Banner_comment'] = "註釋";
$lang['Banner_description'] = "圖片說明";
$lang['Banner_description_explain'] = "這些文字會在滑鼠於圖片上時顯示出來";
$lang['Banner_url'] = "連結網址";
$lang['Banner_url_explain'] ="當滑鼠按下時會連結的網址";
$lang['Banner_owner']="廣告管理員";
$lang['Banner_owner_explain']="指定的用戶將可以管理論壇的廣告";
$lang['Banner_placement'] = "廣告排序";
$lang['Banner_clicks'] = "點擊數";
$lang['Banner_view'] = "觀看數";
$lang['Banner_weigth'] = "廣告曝光率";
$lang['Banner_weigth_explain'] = "指廣告在同時間內出現的比例 (1-99)";
$lang['Show_to_users'] ='顯示給使用者';
$lang['Show_to_users_explain'] ='選擇哪類型的廣告能給使用者看';
$lang['Show_to_users_select'] = '使用者必須 %s to %s'; //%s are supstituded with dropdown selections
$lang['Banner_level']['-1'] = '訪客';
$lang['Banner_level']['0'] = '會員';
$lang['Banner_level']['1'] = '版面管理員';
$lang['Banner_level']['2'] = '系統管理員';
$lang['Banner_level_type']['0'] = '等於';
$lang['Banner_level_type']['1'] = '小於或等於';
$lang['Banner_level_type']['2'] = '大於或等於';
$lang['Banner_level_type']['3'] = '不是';

$lang['Time_interval'] = "時間間隔";
$lang['Time_interval_explain'] = "只允許日, 星期, 時刻";
$lang['Start'] = "開始";
$lang['End'] = "結束";
$lang['Year'] = "年";
$lang['Month'] = "月";
$lang['Date'] = "日";
$lang['Weekday'] = "星期";
$lang['Hour'] = "小時";
$lang['Min'] = "分";
$lang['Time_type'] = "時間類別";
$lang['Time_type_explain'] = "選擇訊息是以時刻間隔或是日期間隔定義 <i>(你仍是可以採用時刻間隔, 假如你以日期作為基本規則的話)</i>";
$lang['Not_specify'] = "不指定";
$lang['No_time'] = "沒有定義";
$lang['By_time'] = "用時刻排序";
$lang['By_week'] = "用星期排序";
$lang['By_date'] = "用日期排序";

// messages
$lang['Missing_banner_id'] = "這個廣告 id 遺失了";
$lang['Missing_banner_owner'] = "你必須指定廣告管理員";
$lang['Missing_time'] = "當你以時刻作為廣告的基本規則時, 你必須規定時刻間隔";
$lang['Missing_date'] ="當你以日期作為廣告的基本規則時, 你必須規定日期間隔";
$lang['Missing_week'] ="當你以星期作為廣告的基本規則時, 你最少必須規定星期間隔和時刻間隔";

$lang['Banner_removed'] = "廣告已經移除了";
$lang['Banner_updated'] = "廣告資訊已經更新了";
$lang['Banner_added'] = "廣告已經加入了";
$lang['Click_return_banneradmin'] = '按下 %s這裡%s 返回廣告管理控制台';
$lang['Banner'] = '橫幅廣告';
$lang['No_redirect_error'] = '如果頁面很久還未出現,請按 <b><a href="%s">這裡<a></b> 進入你要求的網址';
$lang['Left_via_banner'] = '左 via 廣告';
?>
?>[/php]