Instrukcja do hacku który obiecałem zrobić, testowana na phpbb 2.0.17.
Jak wygląda śnieg to możecie zobaczyć na:
http://forum.zs-6.com/
Nie obciąża procesora za bardzo, ale użytkownicy na moim forum płakali więc zrobiłem możliwość wł/wył w profilu.
Śnieg jest kontabilny z większościami przeglądarek:
IE, FF, Opera i Konqueror'em.
Ten hack, który był podawany w archiwum nie działał z ff i nie miał możliwości wł/wył w profilu.
W downloadzie nie wcale śniegu - więc jeśli hack przejdzie pomyślnie faze testów to możecie go wrzucić do downloadu.
Kod:
####################################################################################
## Nazwa moda: Śnieg JavaScript OFF/ON
## Autor: p-maz - p-maz@phpnuke.org.pl - http://phpnuke.org.pl
## Wersja moda: 1.0.1
## Opis: Mod dodający Śnieg JavaScript na stronę, oraz dodatkowo można go włączyć,
## lub wyłączyć w profilu usera! Kontabilny z większością przeglądarek.
##
## Poziom instalacji Łatwy
## Czas instalacji: 5-10 Minut
##
## Ilość plików do edycji: 6
## Plików do wyedytowania: includes/page_header.php
## includes/usecp_register.php
## includes/usercp_avatart.php
## templates/{TWÓJ_STYL}/profile_add_body.tpl
## templates/{TWÓJ_STYL}/overall_header.tpl
## language/lang_polish/lang_main.php
##
## Dołączonych plików: n/a
##
####################################################################################
#
#-----[ SQL ]--------------------------------
#
ALTER TABLE `phpbb_users` ADD `user_snieg` TINYINT( 1 ) DEFAULT '1' NOT NULL;
#
#-----[ OTWÓRZ ]------------------------------------------
#
includes/page_header.php
#
#-----[ ZNAJDŹ ]------------------------------------------
#
//
// Login box?
//
if ( !$userdata['session_logged_in'] )
{
$template->assign_block_vars('switch_user_logged_out', array());
//
#
#-----[ PRZED TYM DODAJ ]------------------------------------
#
if ( $userdata['user_snieg'] )
{
$template->assign_block_vars('switch_user_snieg', array());
}
#
#-----[ OTWÓRZ ]------------------------------------------
#
includes/usecp_register.php
#
#-----[ ZNAJDŹ ]------------------------------------------
#
$popup_pm = ( isset($HTTP_POST_VARS['popup_pm']) ) ? ( ($HTTP_POST_VARS['popup_pm']) ? TRUE : 0 ) : TRUE;
#
#-----[ PO TYM DODAJ ]------------------------------------
#
$user_snieg = ( isset($HTTP_POST_VARS['user_snieg']) ) ? ( ($HTTP_POST_VARS['user_snieg']) ? TRUE : 0 ) : 0;
#
#-----[ ZNAJDŹ ]------------------------------------------
#
$sql = "UPDATE " . USERS_TABLE . "
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_tlen = '" . str_replace("\'", "''", $tlen) . "', user_gg = '" . str_replace("\'", "''", $gg) . "', user_gg_mod = $gg_mod, user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popup_pm, hide_quick_reply = $hide_quick_reply, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . ", user_gender = '$gender'
WHERE user_id = $user_id";
#
#-----[ W LINI ZNAJDŹ ]------------------------------------------
#
user_popup_pm = $popup_pm,
#
#-----[ PO TYM DODAJ (W LINI) ]------------------------------------
#
user_snieg = $user_snieg,
#
#-----[ ZNAJDŹ ]------------------------------------------
#
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email,
#
#-----[ W LINI ZNAJDŹ ]------------------------------------------
#
user_popup_pm,
#
#-----[ PO TYM DODAJ (W LINI) ]------------------------------------
#
user_snieg,
#
#-----[ ZNAJDŹ ]------------------------------------------
#
VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $aqq) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popup_pm,
#
#-----[ PO TYM DODAJ (W LINI) ]------------------------------------
#
$user_snieg,
#
#-----[ ZNAJDŹ ]------------------------------------------
#
$popup_pm = $userdata['user_popup_pm'];
#
#-----[ PO TYM DODAJ ]------------------------------------
#
$user_snieg = $userdata['user_snieg'];
#
#-----[ ZNAJDŹ ]------------------------------------------
#
display_avatar_gallery($mode, $avatar_category, $user_id, $email, $current_email, $coppa, $username, $email, $new_password, $cur_password, $password_confirm, $icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature, $viewemail, $notifypm, $popup_pm,
#
#-----[ PO TYM DODAJ ]------------------------------------
#
$user_snieg,
#
#-----[ ZNAJDŹ ]------------------------------------------
#
'POPUP_PM_YES' => ( $popup_pm ) ? 'checked="checked"' : '',
'POPUP_PM_NO' => ( !$popup_pm ) ? 'checked="checked"' : '',
#
#-----[ PO TYM DODAJ ]------------------------------------
#
'USER_SNIEG_YES' => ( $user_snieg ) ? 'checked="checked"' : '',
'USER_SNIEG_NO' => ( !$user_snieg ) ? 'checked="checked"' : '',
#
#-----[ ZNAJDŹ ]------------------------------------------
#
'L_PREFERENCES' => $lang['Preferences'],
#
#-----[ PO TYM DODAJ ]------------------------------------
#
'L_SNIEG' => $lang['Snieg'],
#
#-----[ OTWÓRZ ]------------------------------------------
#
usercp_avatart.php
#
#-----[ ZNAJDŹ ]------------------------------------------
#
function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, &$new_password, &$cur_password, &$password_confirm, &$icq, &$aim, &$msn, &$yim, &$website, &$location, &$occupation, &$interests, &$signature, &$viewemail, &$notifypm, &$popup_pm,
#
#-----[ PO TYM DODAJ (W LINI) ]------------------------------------
#
&$user_snieg,
#
#-----[ ZNAJDŹ ]------------------------------------------
#
$params = array('coppa', 'user_id', 'username', 'email', 'current_email', 'cur_password', 'new_password', 'password_confirm', 'icq', 'aim', 'aqq', 'msn', 'yim', 'website', 'location', 'occupation', 'interests', 'signature', 'viewemail', 'notifypm', 'popup_pm',
#
#-----[ PO TYM DODAJ (W LINI) ]------------------------------------
#
'user_snieg',
#
#-----[ OTWÓRZ ]------------------------------------------
#
templates/{TWÓJ_STYL}/profile_add_body.tpl
#
#-----[ ZNAJDŹ ]------------------------------------------
# Albo podobną linijkę tam gdzie bedzie funckcja "{L_PREFERENCES}".
<tr>
<th class="thSides" colspan="2" height="25" valign="middle">{L_PREFERENCES}</th>
</tr>
#
#-----[ PO TYM DODAJ ]------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_SNIEG}</span></td>
<td class="row2">
<input type="radio" name="user_snieg" value="1" {USER_SNIEG_YES} />
<span class="gen">{L_YES}</span>
<input type="radio" name="user_snieg" value="0" {USER_SNIEG_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
#
#-----[ OTWÓRZ ]------------------------------------------
#
templates/{TWÓJ_STYL}/overall_header.tpl
#
#-----[ ZNAJDŹ ]------------------------------------------
#
<body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}">
#
#-----[ PO TYM DODAJ ]------------------------------------
#
<!-- BEGIN switch_user_snieg -->
<script language="Javascript" type="text/javascript">
// Set the number of snowflakes (more than 30 - 40 not recommended)
var snowmax=35
// Set the colors for the snow. Add as many colors as you like
var snowcolor=new Array("#AAAACC","#DDDDFF","#CCCCDD","#F3F3F3","#F0FFFF")
// Set the fonts, that create the snowflakes. Add as many fonts as you like
var snowtype=new Array("Arial Black","Arial Narrow","Times","Comic Sans MS")
// Set the letter that creates your snowflake (recommended: * )
var snowletter="*"
// Set the speed of sinking (recommended values range from 0.3 to 2)
var sinkspeed=0.6
// Set the maximum-size of your snowflakes
var snowmaxsize=22
// Set the minimal-size of your snowflakes
var snowminsize=8
// Set the snowing-zone
// Set 1 for all-over-snowing, set 2 for left-side-snowing
// Set 3 for center-snowing, set 4 for right-side-snowing
var snowingzone=1
/*
// * NO CONFIGURATION BELOW HERE *
*/
// Do not edit below this line
var snow=new Array()
var marginbottom
var marginright
var timer
var i_snow=0
var x_mv=new Array();
var crds=new Array();
var lftrght=new Array();
var browserinfos=navigator.userAgent
var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/)
var ns6=document.getElementById&&!document.all
var opera=browserinfos.match(/Opera/)
var browserok=ie5||ns6||opera
function randommaker(range) {
rand=Math.floor(range*Math.random())
return rand
}
function initsnow() {
if (ie5 || opera) {
marginbottom = document.body.clientHeight
marginright = document.body.clientWidth
}
else if (ns6) {
marginbottom = window.innerHeight
marginright = window.innerWidth
}
var snowsizerange=snowmaxsize-snowminsize
for (i=0;i<=snowmax;i++) {
crds[i] = 0;
lftrght[i] = Math.random()*15;
x_mv[i] = 0.03 + Math.random()/10;
snow[i]=document.getElementById("s"+i)
snow[i].style.fontFamily=snowtype[randommaker(snowtype.length)]
snow[i].size=randommaker(snowsizerange)+snowminsize
snow[i].style.fontSize=snow[i].size
snow[i].style.color=snowcolor[randommaker(snowcolor.length)]
snow[i].sink=sinkspeed*snow[i].size/5
if (snowingzone==1) {snow[i].posx=randommaker(marginright-snow[i].size)}
if (snowingzone==2) {snow[i].posx=randommaker(marginright/2-snow[i].size)}
if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4}
if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2}
snow[i].posy=randommaker(2*marginbottom-marginbottom-2*snow[i].size)
snow[i].style.left=snow[i].posx
snow[i].style.top=snow[i].posy
}
movesnow()
}
function movesnow() {
for (i=0;i<=snowmax;i++) {
crds[i] += x_mv[i];
snow[i].posy+=snow[i].sink
snow[i].style.left=snow[i].posx+lftrght[i]*Math.sin(crds[i]);
snow[i].style.top=snow[i].posy
if (snow[i].posy>=marginbottom-2*snow[i].size || parseInt(snow[i].style.left)>(marginright-3*lftrght[i])){
if (snowingzone==1) {snow[i].posx=randommaker(marginright-snow[i].size)}
if (snowingzone==2) {snow[i].posx=randommaker(marginright/2-snow[i].size)}
if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4}
if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2}
snow[i].posy=0
}
}
var timer=setTimeout("movesnow()",50)
}
for (i=0;i<=snowmax;i++) {
document.write("<span id='s"+i+"' style='position:absolute;top:-"+snowmaxsize+"'>"+snowletter+"</span>")
}
if (browserok) {
window.onload=initsnow
}
</script>
<!-- END switch_user_snieg -->
#
#-----[ OTWÓRZ ]------------------------------------------
#
language/lang_polish/lang_main.php
#
#
#-----[ ZNAJDŹ ]------------------------------------------
#
$lang['Preferences'] = 'Preferencje';
#
#-----[ PO TYM DODAJ ]------------------------------------
#
$lang['Snieg'] = 'Pokaż ¶nieg na forum:<br /><font size="1">Osob±, które posiadaj± słaby procesor zaleca się wył. ¶niegu</font>';
#
#-----[ ZAPISZ I ZAMKNIJ WSZYSTKIE PLIKI ]--------------------------
#
#EoM
Pozdrawiam, miłego testowania.
p-maz
Uwagi moderatora p-maz (dodane 20 Lis 2005, 18:28):
Ostatnio edytowany przez p-maz 20 Lis 2005, 18:28, edytowano w sumie 2 razy