1.12.7 i starsze - Multiple Ranks 2.1a (Beta)
domino6824 - 30-11-2009, 19:34
They2 napisał/a: | napraw i optymalizuj tabele w phpmyadmin | optymalizowałem, i to samo cały czas błąd w admin_ranks.php w lini 308
They2 - 30-11-2009, 19:38
to sprawdz gdzie popelniles blad w/g instrukcji w pliku admin_ranks.php
zaczynajac od linii 300 do 370
innamuza - 30-11-2009, 20:32
W instrukcji jest : Kod: |
function bbencode_second_pass($text, $uid, $username = '')
{
...
}
|
Na: Kod: |
$usergroups_ids = array();
$usergroups_checked = false;
@include($phpbb_root_path . "includes/users_bbcode.$phpEx");
function get_users_groups($topic_id)
{
global $usergroups_checked, $usergroups_ids, $db;
if ( !$usergroups_checked && $topic_id > 0 )
{
$usergroups_checked = true;
$sql = "select p.poster_id as user_id, g.group_id
from " . POSTS_TABLE . " p
left join " . USER_GROUP_TABLE . " ug ON ug.user_id = p.poster_id
left join " . GROUPS_TABLE . " g ON g.group_id = ug.group_id
where g.group_single_user = 0
and p.topic_id = $topic_id";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Couldn\'t obtain user groups data', '', __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result) )
{
if ( @!in_array($row['group_id'], $usergroups_ids[$row['user_id']]) )
{
$usergroups_ids[$row['user_id']][] = $row['group_id'];
}
}
}
return $usergroups_ids;
}
function preg_pos( $bbintro, $text )
{
$a = array();
$last_pos = 0;
do
{
preg_match("#\[((/*)$bbintro((=| )((.(?<!\]))*?))*)\]#i", $text, $bbpos, PREG_OFFSET_CAPTURE, $last_pos);
if ( $bbpos[0][0] )
{
$a['offsets'][] = $bbpos[0][1];
$a['types'][$bbpos[0][1]] = ( (!strlen($bbpos[2][0])) ? 'in' : 'out' );
$a['items'][$bbpos[0][1]] = $bbpos[0][0];
$last_pos = $bbpos[0][1] + 1;
}
}
while ( $bbpos[0][0] );
@asort($a['offsets']);
@ksort($a['types']);
return $a;
}
function check_replies( $topic_id, $user_id, &$topic_last_reply )
{
global $db;
if ( $user_id < 2 || !$topic_id )
{
return false;
}
else if ( !$topic_last_reply )
{
$sql = " select post_id from " . POSTS_TABLE . " where poster_id = $user_id and topic_id = $topic_id order by post_id DESC limit 1";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Couldn\'t obtain topic replies.', '', __LINE__, __FILE__, $sql);
}
$topic_last_reply = $db->sql_fetchrow($result);
$topic_last_reply = ( $topic_last_reply['post_id'] ) ? $topic_last_reply['post_id'] : '-1';
}
return true;
}
function hide_control( $txt, $post_id, $topic_poster_id, $forum_id )
{
global $beermod, $topic_last_reply, $userdata;
preg_match_all('#\[hide((.(?<!\]))*?)\](.*?)\[/hide((.(?<!\]))*?)\]#is', $txt, $arr);
if ( !count($arr[0]) )
{
return $txt;
}
$beermod_unhide_forums = @explode(',', $beermod->config['unhide_bbcode_forums']);
foreach( $arr[0] as $id => $replacement )
{
if ( !$userdata['session_logged_in'] )
{
$return_val = 'Wiadomo¶ć została ukryta, aby j± przeczytać należy się zalogować.';
}
else if ( ( $topic_poster_id == $userdata['user_id'] ) || ( $post_id < $topic_last_reply && $post_id ) || $userdata['user_level'] || @in_array($userdata['user_id'], $beermod->topic_replies[$post_id]) )
{
$return_val = $arr[3][$id];
}
else if ( @in_array($forum_id, $beermod_unhide_forums) )
{
$return_val = 'Wiadomo¶ć została ukryta, aby j± przeczytać postaw autorowi posta piwo, lub odpowiedz na temat.';
}
else
{
$return_val = 'Wiadomo¶ć została ukryta, aby j± przeczytać należy odpowiedzieć w temacie.';
}
$txt = str_replace($replacement, '[hide]' . $return_val . '[/hide]', $txt);
}
return $txt;
}
function bbencode_second_pass($text, $uid, $postdata, $topic_id = 0, $is_sig = false)
{
global $db, $lang, $userdata;
$user_groups = get_users_groups(intval($topic_id));
if ( strlen($uid) == BBCODE_UID_LEN )
$text = str_replace( ':' . $uid, '', $text );
$text = str_replace( array('\'', '"', '\\' ), array( ''', '"', '\' ), $text );
preg_match_all('#\[/((.*?)(:[0-9a-f]+))\]#', $text, $arr);
foreach( $arr[1] as $id => $value )
{
$text = str_replace($arr[1], $arr[2], $text);
if ( strlen($arr[3]) > 1 )
$text = str_replace($arr[3], '', $text);
}
if ( $bbcode_cache = sql_cache('check', 'bbcode') )
{
include($bbcode_cache);
}
else
{
$bbcode_data = array();
$sql = "select *
from " . BBCODE_TABLE . "
order by bbcode_lock DESC, bbcode_id ASC";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Couldn\'t obtain bbcode data', '', __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result) )
{
$bbid = $row['bbcode_id'];
unset($row['bbcode_id']);
$bbcode_data[$bbid] = $row;
}
sql_cache('write', 'bbcode', $bbcode_data);
$bbcode = $bbcode_data;
}
$used_bbintro = array();
$bbcode_top_id = array();
$bbcode_ids = array();
foreach( $bbcode as $row )
{
if ( !$row['bbcode_sig'] && $is_sig ) continue;
if ( $row['bbcode_admin'] && $postdata['user_level'] != ADMIN ) continue;
if ( $row['bbcode_mod'] && !$postdata['user_level'] ) continue;
if ( $row['bbcode_logged'] && $postdata['user_id'] == ANONYMOUS ) continue;
if ( $row['bbcode_groups'] && !$postdata['user_level'] )
{
$bbgroups = explode(',', $row['bbcode_groups']);
$stop_groups = false;
foreach( $bbgroups as $groupid )
{
if ( @in_array($groupid, $user_groups[$postdata['user_id']]) )
{
$stop_groups = true;
break;
}
}
if ( !$stop_groups )
{
continue;
}
}
$bbcode_id = 0;
$bbintro = preg_replace('#^\[([a-z_0-9]+)(.+?)$#', '\\1', strtolower($row['bbcode_in']));
if ( !in_array($bbintro, $used_bbintro) )
{
$bbdata = preg_pos($bbintro, $text);
$used_bbintro[] = $bbintro;
if ( !count($bbdata['offsets']) )
continue;
$_offset = 0;
$used_ids = array();
$used_bbcode_ids = array();
foreach( $bbdata['offsets'] as $offset )
{
if ( $bbdata['types'][$offset] == 'in' )
{
$bbcode_id++;
$used_ids[] = $bbcode_id;
$used_bbcode_ids[] = $bbcode_id;
}
else
{
sort($used_ids);
$bbcode_id = $used_ids[(count($used_ids)-1)];
unset($used_ids[(count($used_ids)-1)]);
}
$bbcode_id = intval($bbcode_id);
$replacement_in = $bbdata['items'][$offset];
$replacement_out = str_replace("]", ":$bbcode_id]", $bbdata['items'][$offset]);
$text = substr_replace($text, $replacement_out, $offset + $_offset, strlen($bbdata['items'][$offset]));
$_offset = $_offset + (strlen($replacement_out) - strlen($bbdata['items'][$offset]));
$bbcode_top_id[$bbintro] = ( $bbcode_top_id[$bbintro] < $bbcode_id ) ? $bbcode_id : $bbcode_top_id[$bbintro];
}
$bbcode_ids[$bbintro] = $used_bbcode_ids;
}
if ( preg_match( '#\{LANG_([a-zA-Z0-9_]+)\}#', $row['bbcode_out']) )
{
preg_match_all( '#\{LANG_([a-zA-Z0-9_]+)\}#', $row['bbcode_out'], $langs );
foreach ( $langs[0] as $id => $replacement )
{
$row['bbcode_out'] = str_replace($replacement, $lang[$langs[1][$id]], $row['bbcode_out']);
}
}
preg_match_all('#\{[A-Z0-9_]+\}#', $row['bbcode_in'], $bbvars);
$func = $row['bbcode_func'];
$count = count($bbcode_ids[$bbintro]);
for( $i = 0; $i <= $count; $i++ )
{
$id = $bbcode_ids[$bbintro][$i];
$replacement_pattern = trim($row['bbcode_in']);
$replacement_pattern = str_replace("[", "\[", $replacement_pattern);
$replacement_pattern = str_replace("]", ":$id\]", $replacement_pattern);
preg_match_all("#\[((.(?<!\]))+?)\]#i", $replacement_pattern, $inside);
$inside_a = $inside[0][0];
$inside_b = $inside[0][1];
foreach( $bbvars[0] as $var )
{
if ( strpos($inside_a, $var) || strpos($inside_b, $var) )
$replacement_pattern = str_replace($var, '((.(?<!\[)(?<!\]))+?)', $replacement_pattern);
}
$replacement_pattern = preg_replace('#\{[A-Z0-9_]+\}#', '(.+?)', $replacement_pattern);
preg_match_all("#$replacement_pattern#is", $text, $arr);
$replacement = $row['bbcode_out'];
$is_used = ( count($arr[0]) ) ? true : false;
if ( !$func )
{
for ( $j = 1; $j <= count($bbvars[0]); $j++ )
{
$replacement_in = $bbvars[0][($j-1)];
$replacement_out = ( $row['bbcode_lock'] ) ? str_replace(array('[', ']'), array('[', ']'), $arr[($j+($j-1))][0]) : $arr[($j+($j-1))][0];
$replacement_out = str_replace('"', '', $replacement_out);
if( $row['bbcode_lock'] )
{
$replacement = str_replace( array( '.', '@', '/' ), array( '.', '@', '/' ), $replacement_out );
}
$replacement = str_replace($replacement_in, $replacement_out, $replacement);
}
}
else
{
$arr[1][0] = ( $row['bbcode_lock'] ) ? str_replace(array('[', ']'), array('[', ']'), $arr[1][0]) : $arr[1][0];
$arr[3][0] = ( $row['bbcode_lock'] ) ? str_replace(array('[', ']'), array('[', ']'), $arr[3][0]) : $arr[3][0];
if( $row['bbcode_lock'] )
{
$arr[1][0] = str_replace( array( '.', '@', '/' ), array( '.', '@', '/' ), $arr[1][0] );
$arr[3][0] = str_replace( array( '.', '@', '/' ), array( '.', '@', '/' ), $arr[3][0] );
}
switch( count($bbvars[0]) )
{
case '1' : $replacement = $func($arr[1][0]); break;
case '2' : $replacement = $func($arr[1][0], $arr[3][0]); break;
default : $replacement = $func(); break;
}
if ( $row['bbcode_out'] )
{
$replacement = preg_replace('#\{[A-Z0-9_]+\}#', $replacement, $row['bbcode_out']);
}
}
$text = str_replace($arr[0][0], $replacement, $text);
if ( $is_used )
{
unset($bbcode_ids[$bbintro][$i]);
$text = preg_replace("#(\[|\&\#91;)($bbintro(.(?<!\])(?<!\&\#93;))+?):($id|0)(\]|\&\#93;)#i", '\\1\\2\\5', $text);
}
}
if ( count($bbcode_ids[$bbintro]) )
sort($bbcode_ids[$bbintro]);
}
if ( $is_sig || $postdata['user_id'] != $userdata['user_id'] )
$text = preg_replace("#(\[|\&\#91;)((.(?<!\])(?<!\&\#93;))+?):[0-9]+(\]|\&\#93;)#i", '', $text);
$text = preg_replace("#(\[|\&\#91;)((.(?<!\])(?<!\&\#93;))+?):[0-9]+(\]|\&\#93;)#i", '\\1\\2\\4', $text);
return $text;
} |
To jest u mnie linia 332-621
Wywala błąd:
Kod: | Warning: Missing argument 3 for bbencode_second_pass(), called in /home/users/innamuza/public_html/innamuza.pl/index.php on line 346 and defined in /home/users/innamuza/public_html/innamuza.pl/includes/bbcode.php on line 438
Warning: Missing argument 3 for bbencode_second_pass(), called in /home/users/innamuza/public_html/innamuza.pl/index.php on line 352 and defined in /home/users/innamuza/public_html/innamuza.pl/includes/bbcode.php on line 438 | [/code]
[ Dodano: 30-11-2009, 20:36 ]
już jest ok poradziłem sobie ,za dużo modów:)
They2 - 01-12-2009, 02:44
innamuza, podales to jest w pliku bbcode.php pewnie musiales sie pomylic z tym tematem
domino6824 - 01-12-2009, 20:10
They2 napisał/a: | to sprawdz gdzie popelniles blad w/g instrukcji w pliku admin_ranks.php
zaczynajac od linii 300 do 370 |
wszystko ok
Plati - 10-12-2009, 19:45
Ja mam zaś taki błąd:
Kod: | Fatal error: Call to undefined function generate_ranks() in /home/accounts_p/plati/public_html/viewtopic.php on line 1870 |
Ta linia wygląda tak:
Kod: | $user_ranks = generate_ranks($postrow[$i], $ranks_sql); |
A fragment kodu wokół niej:
Kod: | else
{
$mini_post_img = $images['icon_minipost'];
}
$mini_post_url = append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $postrow_post_id) . '#' . $postrow_post_id;
// MOD Multiple Ranks 2.1 by Matrix
$user_ranks = generate_ranks($postrow[$i], $ranks_sql);
$user_rank_01 = ($user_ranks['rank_01'] == '') ? '' : ($user_ranks['rank_01'] . '<br />');
$user_rank_01_img = ($user_ranks['rank_01_img'] == '') ? '' : ($user_ranks['rank_01_img'] . '<br />');
$user_rank_02 = ($user_ranks['rank_02'] == '') ? '' : ($user_ranks['rank_02'] . '<br />');
$user_rank_02_img = ($user_ranks['rank_02_img'] == '') ? '' : ($user_ranks['rank_02_img'] . '<br />');
$user_rank_03 = ($user_ranks['rank_03'] == '') ? '' : ($user_ranks['rank_03'] . '<br />');
$user_rank_03_img = ($user_ranks['rank_03_img'] == '') ? '' : ($user_ranks['rank_03_img'] . '<br />');
$user_rank_04 = ($user_ranks['rank_04'] == '') ? '' : ($user_ranks['rank_04'] . '<br />');
$user_rank_04_img = ($user_ranks['rank_04_img'] == '') ? '' : ($user_ranks['rank_04_img'] . '<br />');
$user_rank_05 = ($user_ranks['rank_05'] == '') ? '' : ($user_ranks['rank_05'] . '<br />');
$user_rank_05_img = ($user_ranks['rank_05_img'] == '') ? '' : ($user_ranks['rank_05_img'] . '<br />');
// MOD Multiple Ranks 2.1 by Matrix
$show_custom_rank = false;
$custom_rank_mod = false;
if ( $poster_posts >= $board_config['allow_custom_rank'] )
{
$show_custom_rank = true;
}
if ( $poster_is_mod || $poster_level == ADMIN || $poster_is_jr_admin )
{
$custom_rank_mod = true;
} |
They2 - 10-12-2009, 23:18
Plati, w pierwszym poscie masz to rozwiazanie, zacznij czytac.
Plati - 11-12-2009, 08:18
Aha ... dobra, myślałem że to było do poprzedniej wersji
Z tymi poprawkami to można by było zrobić wersję 2.1b
QQxQ - 16-12-2009, 13:06
Nie znalazlem to pytam.
Wiec mam taki problem bo u kazdego mam ustawione.
1.Ranga Post to sa %
2.Ranga Dnia to bedzie ranga ustawiana np na swieta itp.
3.Nic niema a jak zrobic zeby byla to ranga specjalna?
4.Nic niema a jak zrobic zeby byla to ranga specjalna?
5.Nic niema a jak zrobic zeby byla to ranga zbanowany?
Oczywiscie zeby w 3,4 pokazywalo te rangi do ktorych osoba przynalezy i sa najwyzej ustawione w statusie.
Bo teraz jak dodam kogos do grupy to nic sie nie zmienia
[ Dodano: 16-12-2009, 15:34 ]
Oraz czy da sie przeniesc avatar zeby byl.
Ranga Postow
Avatar
Reszta rang
Bo mam teraz Avatar pod wszystkimi rangami
DanWarez - 30-12-2009, 16:39
witam
mam problem bo niewyswietlaja mi sie rangi w postach ale w profilu jest gdzie moze byc problem
szczupak_xD - 30-12-2009, 16:40
viewtopic_body.tpl
DanWarez - 30-12-2009, 16:42
Szczupek, a tak dokladniej moze
szczupak_xD - 30-12-2009, 16:47
wykonaj all zgodnie z instrukcją
DanWarez - 30-12-2009, 16:54
Szczupek, wykonalem i nic
[ Dodano: 30-12-2009, 16:56 ]
Szczupek,
tam tylko sie robi to
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ IN-LINE FIND ]----------------------------------------
#
{postrow.POSTER_RANK}{postrow.CUSTOM_RANK}{postrow.RANK_IMAGE}
#
#-----[ IN-LINE REPLACE WITH ]--------------------------------
#
{postrow.CUSTOM_RANK}{postrow.USER_RANK_01}{postrow.USER_RANK_01_IMG}{postrow.USER_RANK_02}{postrow.USER_RANK_02_IMG}{postrow.USER_RANK_03}{postrow.USER_RANK_03_IMG}{postrow.USER_RANK_04}{postrow.USER_RANK_04_IMG}{postrow.USER_RANK_05}{postrow.USER_RANK_05_IMG}<br />
szczupak_xD - 30-12-2009, 16:58
i zamieniłes dobrze a viewtopic.php
|
|
|