Code: Alles auswählen
##############################################################
## MOD Title: Advanced Countdown
## MOD Author: OXPUS < webmaster@oxpus.de > (Karsten Ude) http://www.oxpus.de
## MOD Description: Adds a countdown block on your index and (if aviable)
## on your portal.
## The countdown can enabled/disabled and modify on the ACP.
## MOD Version: 1.0.8
##
## Installation Level: Easy
## Installation Time: 2-3 Minutes
## Files To Edit: 5
## index.php
## portal.php (if installed)
## includes/constants.php
## includes/page_header.php
## templates/subSilver/overall_header.tpl
##
## Included Files: 4
## admin/admin_countdown.php
## templates/subSilver/admin/countdown_body.tpl
## language/lang_english/lang_countdown.php
## language/lang_german/lang_countdown.php
##############################################################
## 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:
##
## Instead entering the given SQL-Statement, you can upload the file countdown_db_install.php
## to your phpbb root directory and run this with your browser.
## This file will do all nessassary changes in the database for you.
## After using this file, please delete it to avoid errors.
##
##############################################################
## MOD History:
##
## 2005-05-24 - Version 1.0.9
## - FIX Display wrong last post on forum/topic
##
## 2005-04-27 - Version 1.0.8
## - Recode the time management
## For update complete reinstall this hack and replace all files
##
## 2005-04-24 - Version 1.0.7
## - FIX user timezone
## For update reinstall the part for page_header.php
##
## 2005-03-02 - Version 1.0.6
## - FIX using quotes and convert links into html
## For update reinstall the part for page_header.php and replace
## admin/admin_countdown.php
##
## 2005-01-10 - Version 1.0.5
## - FIX displaying right countdown time on ACP
## For update replace
## admin/admin_countdown.php
##
## 2004-09-14 - Version 1.0.4
## - Force display countdown on several browsers
## For update reinstall the part for
## includes/page_header.php
## templates/subSilver/overall_header.tpl
## and replace
## language/lang_english/lang_countdown.php
## language/lang_german/lang_countdown.php
##
## 2004-09-11 - Version 1.0.3
## - Fix bug for time setting
## - Fix displaying countdown on several browsers
## For update reinstall the parts for
## includes/page_header.php
## templates/subSilver/overall_header.tpl
## and replace
## admin/admin_countdown.php
## language/lang_english/lang_countdown.php
## language/lang_german/lang_countdown.php
##
## 2004-04-23 - Version 1.0.2
## - Fix some bugs
## For update reinstall the parts for page_header.php and replace admin/admin_countdown.php
##
## 2004-04-13 - Version 1.0.1
## - Fix error on disabled countdown
## For update reinstall the parts for page_header.php and overall_header.tpl
##
## 2004-04-01 - Version 1.0.0
## - First release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ SQL ]------------------------------------------
#
CREATE TABLE phpbb_countdown (
img_left varchar(255) NOT NULL default '',
img_right varchar(255) NOT NULL default '',
title varchar(100) NOT NULL default '',
description varchar(100) NOT NULL default '',
event_text varchar(200) NOT NULL default '',
event_stop int (11) NOT NULL default '0',
enable_index tinyint (1) default '0',
enable_portal tinyint (1) default '0',
full_display tinyint (1) default '1'
) TYPE=MyISAM;
#
#-----[ COPY ]------------------------------------------
#
copy admin/admin_countdown.php to admin/admin_countdown.php
copy templates/subSilver/admin/admin_countdown_body.tpl to templates/subSilver/admin/admin_countdown_body.tpl
copy language/lang_english/lang_countdown.php to language/lang_english/lang_countdown.php
copy language/lang_german/lang_countdown.php to language/lang_german/lang_countdown.php
#
#-----[ OPEN ]------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------
#
define('IN_PHPBB', true);
#
#-----[ AFTER, ADD ]------------------------------------------
#
define('ON_INDEX', true);
#
#-----[ OPEN ]------------------------------------------
# // Just you have installed a portal!!!
portal.php
#
#-----[ FIND ]------------------------------------------
#
define('IN_PHPBB', true);
#
#-----[ AFTER, ADD ]------------------------------------------
#
define('ON_PORTAL', true);
#
#-----[ OPEN ]------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]------------------------------------------
#
define('USERS_TABLE', $table_prefix.'users');
#
#-----[ AFTER, ADD ]------------------------------------------
#
define('COUNTDOWN_TABLE', $table_prefix.'countdown');
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
//
// Parse and show the overall header.
//
$template->set_filenames(array(
'overall_header' => ( empty($gen_simple_header) ) ? 'overall_header.tpl' : 'simple_header.tpl')
);
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Advanded Countdown Mod START
if ( defined('ON_INDEX') || defined('ON_PORTAL') )
{
include_once($phpbb_root_path.'includes/bbcode.'.$phpEx);
$sql = "SELECT * FROM " . COUNTDOWN_TABLE;
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not get countdown settings', '', __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result))
{
$img_left = $row['img_left'];
$img_right = $row['img_right'];
$title = $row['title'];
$description = $row['description'];
$event_text = stripslashes($row['event_text']);
$event_stop = $row['event_stop'];
$enable_index = $row['enable_index'];
$enable_portal = $row['enable_portal'];
$full_display = $row['full_display'];
}
$event_stop -= $userdata['user_timezone'] * 3600;
$event_stop += (date('I')) ? 3600 : 0;
$b_day = date('d', $event_stop);
$b_month = date('n', $event_stop);
$b_year = date('Y', $event_stop);
$b_hour = date('H', $event_stop);
$b_minute = date('i', $event_stop);
$b_second = date('s', $event_stop);
switch ($b_month)
{
case 1:$b_month = 'January';break;
case 2:$b_month = 'February';break;
case 3:$b_month = 'March';break;
case 4:$b_month = 'April';break;
case 5:$b_month = 'May';break;
case 6:$b_month = 'June';break;
case 7:$b_month = 'July';break;
case 8:$b_month = 'August';break;
case 9:$b_month = 'September';break;
case 10:$b_month = 'October';break;
case 11:$b_month = 'November';break;
case 12:$b_month = 'December';break;
}
$stop = $b_month.' '.$b_day.', '.$b_year.' '.$b_hour.':'.$b_minute.':'.$b_second;
$user_lang = ( $userdata['user_lang'] ) ? $userdata['user_lang'] : $board_config['default_lang'];
include_once($phpbb_root_path . 'language/lang_' . $user_lang . '/lang_countdown.php');
$template->assign_vars(array(
'L_DAYS' => $lang['C_days'],
'IMG_LEFT' => ( $img_left ) ? '<img src="'.$img_left.'" border="0" />' : '',
'IMG_RIGHT' => ( $img_right ) ? '<img src="'.$img_right.'" border="0" />' : '',
'TITLE' => make_clickable(stripslashes($title)),
'DESC' => make_clickable(stripslashes($description)))
);
}
$countdown_on = 0;
if ( defined('ON_INDEX') && $enable_index == 1 )
{
$template->assign_block_vars('switch_countdown_on', array());
$countdown_on = 1;
}
if ( defined('ON_PORTAL') && $enable_portal == 1 )
{
$template->assign_block_vars('switch_countdown_on', array());
$countdown_on = 1;
}
if ( $countdown_on == 1 )
{
$countdown = "<script language='JavaScript' type='text/javascript'>
<!--
var eventdate = new Date('".$stop."');
function toSt(n)
{
s=''
if(n<10) s+='0'
return s+n.toString();
}
function countdown()
{
d=new Date();
count=Math.floor((eventdate.getTime()-d.getTime())/1000);
if(count<=0)
{
var time_event = document.getElementById('time_event');
var event_time = document.getElementById('event_time');
time_event.style.display = 'none';
event_time.style.display = '';
return;
}
secs_count = toSt(count%60);
count=Math.floor(count/60);
mins_count = toSt(count%60);
count=Math.floor(count/60);
hours_count = toSt(count%24);
count=Math.floor(count/24);
days_count = count;
document.countdown.days.value = days_count;
document.countdown.hours.value = hours_count;
document.countdown.mins.value = mins_count;
document.countdown.secs.value = secs_count;
window.setTimeout('countdown()',500);
}
//-->
</script>";
$template->assign_vars(array(
'EVENT_TEXT' => $event_text,
'COUNTDOWN' => $countdown,
'COUNTDOWN_ON' => 'onLoad="javascript:countdown();"'));
}
if ( $full_display == 0 )
{
$template->assign_vars(array(
'FULL_DISPLAY' => 'none'));
}
else
{
$template->assign_vars(array(
'FULL_DISPLAY' => ''));
}
// Advanded Countdown Mod END
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_header.tpl
#
#-----[ FIND ]------------------------------------------
#
</head>
<body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}"/>
#
#-----[ REPLACE WITH ]------------------------------------------
#
{COUNTDOWN}
</head>
<body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}" {COUNTDOWN_ON}/>
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td height="25" align="center" valign="top" nowrap="nowrap"><span class="mainmenu"> <a href="{U_PROFILE}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="{L_PROFILE}" hspace="3" />{L_PROFILE}</a> <a href="{U_PRIVATEMSGS}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_message.gif" width="12" height="13" border="0" alt="{PRIVATE_MESSAGE_INFO}" hspace="3" />{PRIVATE_MESSAGE_INFO}</a> <a href="{U_LOGIN_LOGOUT}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_login.gif" width="12" height="13" border="0" alt="{L_LOGIN_LOGOUT}" hspace="3" />{L_LOGIN_LOGOUT}</a> </span></td>
</tr>
</table></td>
</tr>
</table>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN switch_countdown_on -->
<form name="countdown">
<table align="center" width="100%" cellspacing="2" cellpadding="5" border="0" class="forumline">
<tr>
<th align="center" colspan="3">{TITLE}</th>
</tr>
<tr>
<td align="left" valign="center" width="20%">{IMG_LEFT}</td>
<td align="center" width="60%">
<div class="gen">{DESC}</div><br />
<div id="time_event" class="genmed" style="display:"><b>
{L_DAYS} <input name="days" class="post" size=4 style="border: 0px">
<span style="display: {FULL_DISPLAY};" class="gen" name="time_string">-
<input name="hours" class="post" size=2 style="border: 0px"> :
<input name="mins" class="post" size=2 style="border: 0px"> :
<input name="secs" class="post" size=2 style="border: 0px">
</b></span></div>
<div id="event_time" class="gen" style="display:none">{EVENT_TEXT}</div>
</td>
<td align="right" valign="center" width="20%">{IMG_RIGHT}</td>
</tr>
</table>
</form>
<script language="JavaScript" type="text/javascript">countdown();</script>
<!-- END switch_countdown_on -->
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Kann mir einer sagen wie ich den code am besten in den footer bekomme und wo ich ihn einfügen muss?