nelamurire statistics mod

Discuţii legate de instalarea şi funcţionarea unor MODificări vechi sau noi ale forumului phpBB 2.0.x.
Închis
Avatar utilizator
teror
Utilizator înregistrat
Mesaje: 121
Membru din: 16-Mar-2004, 12:47:55
Ext: Nu
Server: Windows
Nivel phpBB: Mediu
Nivel php: Mediu
Localitate: Cluj
Contact:

nelamurire statistics mod

Mesaj de teror »

Cod: Selectaţi tot

#-------------------------------------------------------------
# NOTE: THIS STEP IS ONLY NEEDED IF YOU USE THE FILE-BASED CACHED TEMPLATE.PHP FILE
#
# If you are using the template cache system (only file-based is mentioned here), 
# please adjust your template.php as followed (This will NOT disable the Template Caching)
# It is a little tweak to let the template use the non-cached output if no cached template 
# file could be found.
#-------------------------------------------------------------

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

#
#-----[ FIND ]---------------------------------------------
# around line 144
            $fp = fopen($cache_file, 'w+');
            fwrite ($fp, '<?php' . "\n" . $this->compiled_code[$handle] . "\n?" . '>');

# 
#-----[ REPLACE WITH ]-------------------------------------- 
# 
            $fp = @fopen($cache_file, 'w+');
            if (!$fp)
            {
                eval($this->compiled_code[$handle]);
                return true;
            }
            fwrite ($fp, '<?php' . "\n" . $this->compiled_code[$handle] . "\n?" . '>');

#
#-----[ FIND ]---------------------------------------------
# around line 188
            $fp = fopen($cache_file, 'w+');
            fwrite ($fp, '<?php' . "\n" . $code . "\n?" . '>');

# 
#-----[ REPLACE WITH ]-------------------------------------- 
# 
            $fp = @fopen($cache_file, 'w+');
            if (!$fp)
            {
                $_str = '';
                eval($code);
                $this->assign_var($varname, $_str);
                return true;
            }
            fwrite ($fp, '<?php' . "\n" . $code . "\n?" . '>');


# EoM 
De unde stiu eu daca am nevoie de partea asta de la mod sau nu am nevoie de ea?


zice ca : THIS STEP IS ONLY NEEDED IF YOU USE THE FILE-BASED CACHED TEMPLATE.PHP FILE

asta n-am inteles ce vrea sa zica..
de unde stiu eu daca forumul foloseste treaba aia? (template.php)
Avatar utilizator
mitnick
Utilizator înregistrat
Mesaje: 149
Membru din: 19-Apr-2004, 16:37:08

Mesaj de mitnick »

includes/template.php

se ocupa cu partea de scriere si de compilare, in forum!
Avatar utilizator
teror
Utilizator înregistrat
Mesaje: 121
Membru din: 16-Mar-2004, 12:47:55
Ext: Nu
Server: Windows
Nivel phpBB: Mediu
Nivel php: Mediu
Localitate: Cluj
Contact:

Mesaj de teror »

asa..
dupa ce am instalat statistics mod, am mai pus si un addon , k sa-mi arate rankurile :)

doar k e o mica eroare:)

imaginea rankului nu mi-o afiseaza :

in loc de :

Cod: Selectaţi tot

http://www.canalul18.dap.ro/forum/images/ranks/rosu/rank0.gif
imi apare asa (am dat click dreapta pe locul unde ar trebui sa fie imaginea, si am dat properties):

Cod: Selectaţi tot

http://www.canalul18.dap.ro/forum//forum/images/ranks/rosu/rank0.gif

si m-am bagat un pic pe la sursa moduluiui

care e asa:

Cod: Selectaţi tot

<?php
/***************************************************************************
 *                              module.php
 *                            -------------------
 *   begin                : Tuesday, Aug 20, 2002
 *   copyright            : RustyDragon 
 *   contact              : <dev@RustyDragon.com>, http://www.RustyDragon.com
 *   $Id: module.php,v 1.3.1.4 2002/10/21 14:59:29 RustyDragon Exp $
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

//
//All your code
//
//Vote Images based on the theme path, (i.e. templates/CURRNT_THEME/ is already inserted below)
$vote_left = 'images/vote_lcap.gif';
$vote_right = 'images/vote_rcap.gif';
$vote_bar = 'images/voting_bar.gif';



$rank = 0;
//
// Getting voting bar info from template
//
if( !$board_config['override_user_style'] )
{
	if( $userdata['user_id'] != ANONYMOUS && isset($userdata['user_style']) )
	{
		$style = $userdata['user_style'];
		if( !$theme )
		$style =  $board_config['default_style'];
	}
	else
	$style =  $board_config['default_style'];
}
else
$style =  $board_config['default_style'];

$sql = 'SELECT *
FROM ' . THEMES_TABLE . "
WHERE themes_id = $style";

if(!$result = $db->sql_query($sql))
{
	message_die(CRITICAL_ERROR, "Couldn't query database for theme info.");
}
if( !$row = $db->sql_fetchrow($result) )
{
	message_die(CRITICAL_ERROR, "Couldn't get theme data for themes_id=$style.");
}

$template_path = $phpbb_root_path . 'templates/' ;
$template_name = $row['template_name'] ;

$current_template_path = $template_path . $template_name . '/';

$template->assign_vars(array(
'LEFT_GRAPH_IMAGE' => $current_template_path . $vote_left,
'RIGHT_GRAPH_IMAGE' => $current_template_path . $vote_right,
'GRAPH_IMAGE' => $current_template_path . $vote_bar)
);

$total_users = get_db_stat('usercount');

$lines_num = 0;

$percentage = 0;
$bar_percent = 0;

//
// Regular ranks
//
$sql = 'SELECT *
FROM ' . RANKS_TABLE . '
WHERE rank_special  != 1
ORDER BY rank_min ASC';

if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't retrieve ranks data", '', __LINE__, __FILE__, $sql);
}

$ranks_count = $db->sql_numrows($result);
$ranks_data = $db->sql_fetchrowset($result);

for ($j = 0; $j < $ranks_count && $lines_num<$return_limit ; $j++)
{
	$rank_min = $ranks_data[$j]['rank_min'];
	if ( $j == $ranks_count - 1 )
	{
		$sql = 'SELECT COUNT(user_id) used_counter
		FROM ' . USERS_TABLE . '
		WHERE user_posts >= '. $rank_min;
		$posts_range = $rank_min . ' + ';
	}
	else
	{
		$rank_max = $ranks_data[$j+1]['rank_min'];
		$sql = 'SELECT COUNT(user_id) used_counter
		FROM ' . USERS_TABLE . '
		WHERE user_posts >= '. $rank_min .'
		AND user_posts < '. $rank_max;
		$posts_range = $rank_min . ' - ' . $rank_max;
	}

	if ($rank_min == ($rank_max - 1)) {
		$posts_range = $rank_min;
	} else {
		$posts_range = $rank_min . " - " . ($rank_max - 1);
	}

	if (!$result = $db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, "Couldn't retrieve ranks data", '', __LINE__, __FILE__, $sql);
	}
	$user_data = $db->sql_fetchrowset($result);
	$user_count = $user_data[0]['used_counter'];
	if ( $j == 0 ){//first row
		$firstcount = $user_count;
		$cst = 90 / $firstcount;
	}
	if ( $user_count != 0  )
	{
		$percentage = round( min(100, ($user_count /$total_users) * 100));
	}
	else
	{
		continue;
	}

	$bar_percent = round($user_count * $cst);
	if ($ranks_data[$j]['rank_image'])
	{
		$rank_image = "<img src='".$phpbb_root_path.$ranks_data[$j]['rank_image']."' border=0 alt=".$ranks_data[$j]['rank_title'].">";
	}
	else
	{
		$rank_image = "";
	}
	$lines_num++;
	$template->assign_block_vars('ranks', array(
	'RANK' => $lines_num,
	'CLASS' => ( !($i+1 % 2) ) ? $theme['td_class2'] : $theme['td_class1'],
	'RANK_TITLE' => $ranks_data[$j]['rank_title'],
	'RANK_IMAGE' => $rank_image,
	'RANK_RANGE' => $posts_range,
	'USERS' => $user_count,
	'PERCENTAGE' => $percentage,
	'BAR' => $bar_percent)
	);
}
/*
//
// Uncomment this if you want to see special ranks statistic
//
$sql = 'SELECT COUNT(u.user_rank) used_counter, r.rank_title , r.rank_image
FROM ' . USERS_TABLE . ' u, '. RANKS_TABLE . ' r
WHERE u.user_id != -1
AND u.user_rank = r.rank_id 
GROUP BY u.user_rank ORDER BY used_counter DESC';

if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't retrieve ranks data", '', __LINE__, __FILE__, $sql);
}

$user_count = $db->sql_numrows($result);
$user_data = $db->sql_fetchrowset($result);

for ($i = 0; $i < $user_count; $i++)
{

	if ( $user_data[$i]['used_counter'] != 0  )
	{
		$percentage = round( min(100, ($user_data[$i]['used_counter'] /$total_users) * 100));
	}
	else
	{
		$percentage = 0;
	}

	$bar_percent = round($user_data[$i]['used_counter'] * $cst);
	if ($user_data[$i]['rank_image'])
	{
		$rank_image = "<img src='".$phpbb_root_path.$user_data[$i]['rank_image']."' border=0 alt=".$user_data[$i]['rank_title'].">";
	}
	else
	{
		$rank_image = "";
	}
	$lines_num++;
	$template->assign_block_vars('ranks', array(
	'RANK' => $lines_num,
	'CLASS' => ( !($i+1 % 2) ) ? $theme['td_class2'] : $theme['td_class1'],
	'RANK_TITLE' => $user_data[$i]['rank_title'],
	'RANK_IMAGE' => $rank_image,
	'RANK_RANGE' => $lang['Rank_special'],
	'USERS' => $user_data[$i]['used_counter'],
	'PERCENTAGE' => $percentage,
	'BAR' => $bar_percent)
	);
}
*/
$template->assign_vars(array(
	'L_RANK' => $lang['Rank'],
	'L_USERS' => $lang['Memberlist'],
	'L_PERCENTAGE' => $lang['Percent'],
	'L_RANK_IMAGE' => $lang['Rank_image'],
	'L_RANK_TITLE' => $lang['Poster_rank'],
	'L_RANK_RANGE' => $lang['Rank_range'],
	'L_GRAPH' => $lang['Graph'],
	'MODULE_NAME' => $lang['module_name'])
);

?>

si eu cred ca greseala este de aici:

Cod: Selectaţi tot

{
		$rank_image = "<img src='".$phpbb_root_path.$ranks_data[$j]['rank_image']."' border=0 alt=".$ranks_data[$j]['rank_title'].">";
	}
ce ar trebui sa modific, ca sa imi apara imaginile de la rankuri? sa nu apara /forum//forum ci /forum ?


pt a vedea eroarea click aici apoi cautati Ranks
Închis

Înapoi la “2.0.x Suport pentru MODificări”

Cine este conectat

Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 20 vizitatori