[ABD] IP Country Flag Olympus 0.5.0a [phpBB 3.0.4] + SVN

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
_mayhem_
Registered User
Posts: 53
Joined: Fri Apr 18, 2008 9:17 pm
Location: Turkey - istanbul
Name: Unsal ASLANBAS
Contact:

Re: [BETA] IP Country Flag Olympus 0.5.0a [phpBB 3.0.4] + SVN

Post by _mayhem_ » Thu Jan 08, 2009 12:46 pm

phpbb versiyon : 3.0.4
phpbb3 site : http://www.forum.sonmermi.com/index.php
mod versiyon : [BETA] IP Country Flag Olympus 0.5.0a [phpBB 3.0.4] + SVN

Code: Select all

error : ip country flags nemberlist no view

http://www.forum.sonmermi.com/memberlist.php
http://www.forum.sonmermi.com/arcade.php

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/functions_display.php on line 1316: Missing argument 5 for get_user_avatar(), called in /includes/arcade/arcade_class.php on line 478 and defined
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3984: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3222)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3986: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3222)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3987: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3222)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3988: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3222)
http://www.forum.sonmermi.com/blog.php?u=2

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/functions_display.php on line 1316: Missing argument 5 for get_user_avatar(), called in /blog/includes/blog_data.php on line 1007 and defined
[phpBB Debug] PHP Notice: in file /includes/functions_display.php on line 1316: Missing argument 5 for get_user_avatar(), called in /blog/includes/blog_data.php on line 1007 and defined
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3984: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3222)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3986: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3222)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3987: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3222)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3988: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3222)
Last edited by _mayhem_ on Thu Jan 08, 2009 1:49 pm, edited 1 time in total.
http://uabnet.com ==)) Turkish Board.

_mayhem_
Registered User
Posts: 53
Joined: Fri Apr 18, 2008 9:17 pm
Location: Turkey - istanbul
Name: Unsal ASLANBAS
Contact:

Re: [BETA] IP Country Flag Olympus 0.5.0a [phpBB 3.0.4] + SVN

Post by _mayhem_ » Thu Jan 08, 2009 12:49 pm

add ip country flags mod.

includes/top5_index.php

Code: Select all


<?php

/***************************************************************************
*
* @name top5_index.php
* @package phpBB3 Portal
* @copyright (c) sjpphpbb _ Ariv
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
 ***************************************************************************/

/***************************************************************************
 *
 *   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.
 *
 ***************************************************************************/

if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
}

$user->add_lang('mods/top5_index_lang');

//line 
	$top_posting_users_sql="SELECT user_id, username, user_posts, user_colour
			FROM " . USERS_TABLE . " where user_id > 0 
			ORDER BY user_posts DESC LIMIT 20"; 
			$top_posting_users = $db->sql_query($top_posting_users_sql);
//line2			
	$last_topic_replies_sql="SELECT topic_id, topic_title, topic_views, topic_last_poster_name, topic_last_poster_colour, topic_last_poster_id, topic_last_post_id 
			FROM " . TOPICS_TABLE . " where topic_id > 0 
			ORDER BY topic_last_post_id  DESC LIMIT 20"; 
			$last_replies = $db->sql_query($last_topic_replies_sql);
//line3			
	$new_mb_sql="SELECT user_id, username, user_regdate , user_colour
			FROM " . USERS_TABLE . " WHERE user_type <> 2
			AND user_inactive_time = 0
			ORDER BY user_regdate DESC LIMIT 20";
			$new_mb = $db->sql_query($new_mb_sql);
 
// préparation de l'affichage (top5 utilisateurs) 
	while 
	($line = mysql_fetch_array($top_posting_users) 
		AND $line2 = mysql_fetch_array($last_replies) 
		AND $line3 = mysql_fetch_array($new_mb))
	{ 
	$usertop5 = append_sid("memberlist.php?mode=viewprofile&u=".$line['user_id']); 
	$newmb = append_sid("memberlist.php?mode=viewprofile&u=".$line3['user_id']); 

	$poster_id = append_sid("memberlist.php?mode=viewprofile&u=".$line2['topic_last_poster_id']);

	$topic = append_sid("viewtopic.php?t=".$line2['topic_id']); 

	$sql = "SELECT poster_id, COUNT(*) AS real_user_posts 
	FROM ".POSTS_TABLE. " 
	WHERE poster_id = ".$line['user_id']." 
	GROUP BY poster_id"; 
	$result = $db->sql_query($sql); 
	$rowuserposts = $db->sql_fetchrow($result); 
	$db->sql_freeresult($result); 
	$posts_per_day = $rowuserposts['real_user_posts']; 

	$sql = "SELECT poster_id, COUNT(*) AS real_user_posts 
	FROM " . POSTS_TABLE . " 
	WHERE poster_id = ".$line3['user_id']." 
	GROUP BY poster_id"; 
	$result = $db->sql_query($sql); 
	$rowuserposts = $db->sql_fetchrow($result); 
	$db->sql_freeresult($result); 
	$posts_per_day2 = $rowuserposts['real_user_posts']; 
	
	$template->assign_block_vars('mini', array( 
		'NEWMB' 			=> $newmb, 
		'NBNAME' 			=> $line3['username'],
		'USERNAME_COLOR2'	=> $line3['user_colour'],			
		'USERNAME_COLOR'	=> $line['user_colour'],		
		'POST' 				=> $posts_per_day2, 
		'POSTER' 			=> $usertop5, 
		'POSTERA' 			=> $line['username'], 
		//'NBPOSTS' 			=> $posts_per_day,
		'NBPOSTS' 			=> $line['user_posts'],  
		'TOPIC' 			=> $topic,
		'POSTER_ID'			=> $poster_id,
		'ID_COLOR'			=> $line2['topic_last_poster_colour'], 
		'ID' 				=> $line2['topic_last_poster_name'],
        'IDV' 				=> $line2['topic_views'],
		'JOINED' 			=> $user->format_date($line3['user_regdate'], $format = 'd M Y'),		
		'NOM' 				=> $line2['topic_title'])
		);
}; 
// fin du top 5 utilisateurs 

// 
//sujet le plus populaire 
// 
	$topic_views_sql="SELECT topic_title,topic_views,topic_id 
		FROM " . TOPICS_TABLE . " 
		ORDER BY topic_views DESC LIMIT 1"; 
		$more_views = $db->sql_query($topic_views_sql); 
	while ($line = mysql_fetch_array($more_views)) 
		{ 
			$topic = append_sid("viewtopic.php?t=".$line['topic_id']); 

	$template->assign_block_vars('pop', array( 
		'TOPIC' => $topic, 
		'POST' => $line['topic_title'], 
		'NB' => $line['topic_views'])); 
	}; 
// fin du sujet le plus populaire

?>
styles/prosilver/template/top5_index.html

Code: Select all

<br />
<div class="forabg"> 
	<div class="inner">
		<span class="corners-top"><span></span></span>
		<ul class="block">
				<dl>
					<dt></dt>
				</dl>
		</ul>
<table cellSpacing="1" cellPadding="0" width="100%" align="center" class="bg2"> 
<tr> 
	<th colspan="2"><div align="center">{L_TOP5_REPLY}</div></th> 
	<th colspan="2"><div align="center">{L_TOP5_LAST_MEMBER}</div></th> 
	<th colspan="2"><div align="center">{L_TOP5_LAST_REPLY}</div></th> 
</tr> 
<tr> 
	<td align="center"  class="row3"><div align="center"><span class="gen">{L_TOP5_NAME}</span></div></td>
	<td align="center"  class="row3"><div align="center"><span class="gen">{L_TOP5_NUMBER}</span></div></td>
	<td align="center"  class="row3"><div align="center"><span class="gen">{L_TOP5_NAME}</span></div></td>
	<td align="center"  class="row3"><div align="center"><span class="gen">{L_TOP5_JOINED}</span></div></td>
	<td align="center"  class="row3"><div align="center"><span class="gen">{L_TOP5_TOPIC}</span></div></td>
	<td align="center"  class="row3"><div align="center"><span class="gen">{L_TOP5_NUMBER_VIEW}</span></div></td>
    <td align="center"  class="row3"><div align="center"><span class="gen">{L_TOP5_EXP2}</span></div></td>
</tr> 
<!-- BEGIN mini --> 
	<!-- IF mini.S_ROW_COUNT is even -->
	<tr class="row1">
	<!-- ELSE -->	
	<tr class="row2">
	<!-- ENDIF -->
<tr> 
	<td align="left" class="row1"><div align="center"><span class="gen">
	  <a href="{mini.POSTER}"><span class="genmed2"><strong><font color="#{mini.USERNAME_COLOR}">{mini.POSTERA}</font></strong></a></span></div></td>
	<td align="center" class="row1"><div align="center"><span class="gen">{mini.NBPOSTS}</span></div></td>
		
	<td align="left" class="row1"><div align="center"><span class="gen">
	  <a href="{mini.NEWMB}"><span class="genmed2"><strong><font color="#{mini.USERNAME_COLOR2}">{mini.NBNAME}</font></strong></a></span></div></td>
	<td align="center" class="row1"><div align="center"><span class="gen">{mini.JOINED}</span></div></td>
	<td align="center" class="row1"><div align="center"><span class="gen"><a href="{mini.TOPIC}">{mini.NOM}</a></span></div></td>
	<td align="left" class="row1">
	  <div align="center"><a href="{mini.POSTER_ID}"><span class="gen"><strong><font color="#{mini.ID_COLOR}">{mini.ID}</font></strong></a></div></td>
    <td align="left"  class="row1"><div align="center"><span class="gen">{mini.IDV}</span></div></td>
</tr> 
<!-- END mini --> 
<!-- BEGIN pop --> 
<tr> 
	<td colspan="6" align="center" class="row2"><span class="gen">{L_TOP5_EXP}<a href="{pop.TOPIC}">{pop.POST}</a> {pop.NB}{L_TOP5_EXP3}{L_TOP5_EXP2}</span></td>
</tr> 
<!-- END pop --> 
</table>
</dd>
				</dl>
			</li>
		</ul>
		<span class="corners-bottom"><span></span></span>
	</div>
</div>



thanks.
http://uabnet.com ==)) Turkish Board.

User avatar
3Di
Former Team Member
Posts: 14477
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: [BETA] IP Country Flag Olympus 0.5.0a [phpBB 3.0.4] + SVN

Post by 3Di » Thu Jan 08, 2009 3:35 pm

_mayhem_ wrote:phpbb versiyon : 3.0.4
phpbb3 site : http://www.forum.sonmermi.com/index.php
mod versiyon : [BETA] IP Country Flag Olympus 0.5.0a [phpBB 3.0.4] + SVN

Code: Select all

error : ip country flags nemberlist no view

http://www.forum.sonmermi.com/memberlist.php
http://www.forum.sonmermi.com/arcade.php

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/functions_display.php on line 1316: Missing argument 5 for get_user_avatar(), called in /includes/arcade/arcade_class.php on line 478 and defined
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3984: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3222)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3986: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3222)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3987: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3222)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3988: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3222)
http://www.forum.sonmermi.com/blog.php?u=2

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/functions_display.php on line 1316: Missing argument 5 for get_user_avatar(), called in /blog/includes/blog_data.php on line 1007 and defined
[phpBB Debug] PHP Notice: in file /includes/functions_display.php on line 1316: Missing argument 5 for get_user_avatar(), called in /blog/includes/blog_data.php on line 1007 and defined
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3984: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3222)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3986: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3222)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3987: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3222)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3988: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3222)
You need to modify your two MODs to fit with mine, I think.

Your MODs: ARCADE (arcade_class.php) and BLOG (blog_data.php). :geek:

Anyway, plese provide me a test account in order to watch that stuff live, feel free to PM me the details.

Thank you.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
✒️ Black Friday 2019 @ The Studio ▪️◾️

User avatar
3Di
Former Team Member
Posts: 14477
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: [BETA] IP Country Flag Olympus 0.5.0a [phpBB 3.0.4] + SVN

Post by 3Di » Thu Jan 08, 2009 3:38 pm

_mayhem_ wrote:add ip country flags mod.

includes/top5_index.php

Code: Select all


<?php

/***************************************************************************
*
* @name top5_index.php
* @package phpBB3 Portal
* @copyright (c) sjpphpbb _ Ariv
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
 ***************************************************************************/

/***************************************************************************
 *
 *   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.
 *
 ***************************************************************************/

if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
}

$user->add_lang('mods/top5_index_lang');

//line 
	$top_posting_users_sql="SELECT user_id, username, user_posts, user_colour
			FROM " . USERS_TABLE . " where user_id > 0 
			ORDER BY user_posts DESC LIMIT 20"; 
			$top_posting_users = $db->sql_query($top_posting_users_sql);
//line2			
	$last_topic_replies_sql="SELECT topic_id, topic_title, topic_views, topic_last_poster_name, topic_last_poster_colour, topic_last_poster_id, topic_last_post_id 
			FROM " . TOPICS_TABLE . " where topic_id > 0 
			ORDER BY topic_last_post_id  DESC LIMIT 20"; 
			$last_replies = $db->sql_query($last_topic_replies_sql);
//line3			
	$new_mb_sql="SELECT user_id, username, user_regdate , user_colour
			FROM " . USERS_TABLE . " WHERE user_type <> 2
			AND user_inactive_time = 0
			ORDER BY user_regdate DESC LIMIT 20";
			$new_mb = $db->sql_query($new_mb_sql);
 
// préparation de l'affichage (top5 utilisateurs) 
	while 
	($line = mysql_fetch_array($top_posting_users) 
		AND $line2 = mysql_fetch_array($last_replies) 
		AND $line3 = mysql_fetch_array($new_mb))
	{ 
	$usertop5 = append_sid("memberlist.php?mode=viewprofile&u=".$line['user_id']); 
	$newmb = append_sid("memberlist.php?mode=viewprofile&u=".$line3['user_id']); 

	$poster_id = append_sid("memberlist.php?mode=viewprofile&u=".$line2['topic_last_poster_id']);

	$topic = append_sid("viewtopic.php?t=".$line2['topic_id']); 

	$sql = "SELECT poster_id, COUNT(*) AS real_user_posts 
	FROM ".POSTS_TABLE. " 
	WHERE poster_id = ".$line['user_id']." 
	GROUP BY poster_id"; 
	$result = $db->sql_query($sql); 
	$rowuserposts = $db->sql_fetchrow($result); 
	$db->sql_freeresult($result); 
	$posts_per_day = $rowuserposts['real_user_posts']; 

	$sql = "SELECT poster_id, COUNT(*) AS real_user_posts 
	FROM " . POSTS_TABLE . " 
	WHERE poster_id = ".$line3['user_id']." 
	GROUP BY poster_id"; 
	$result = $db->sql_query($sql); 
	$rowuserposts = $db->sql_fetchrow($result); 
	$db->sql_freeresult($result); 
	$posts_per_day2 = $rowuserposts['real_user_posts']; 
	
	$template->assign_block_vars('mini', array( 
		'NEWMB' 			=> $newmb, 
		'NBNAME' 			=> $line3['username'],
		'USERNAME_COLOR2'	=> $line3['user_colour'],			
		'USERNAME_COLOR'	=> $line['user_colour'],		
		'POST' 				=> $posts_per_day2, 
		'POSTER' 			=> $usertop5, 
		'POSTERA' 			=> $line['username'], 
		//'NBPOSTS' 			=> $posts_per_day,
		'NBPOSTS' 			=> $line['user_posts'],  
		'TOPIC' 			=> $topic,
		'POSTER_ID'			=> $poster_id,
		'ID_COLOR'			=> $line2['topic_last_poster_colour'], 
		'ID' 				=> $line2['topic_last_poster_name'],
        'IDV' 				=> $line2['topic_views'],
		'JOINED' 			=> $user->format_date($line3['user_regdate'], $format = 'd M Y'),		
		'NOM' 				=> $line2['topic_title'])
		);
}; 
// fin du top 5 utilisateurs 

// 
//sujet le plus populaire 
// 
	$topic_views_sql="SELECT topic_title,topic_views,topic_id 
		FROM " . TOPICS_TABLE . " 
		ORDER BY topic_views DESC LIMIT 1"; 
		$more_views = $db->sql_query($topic_views_sql); 
	while ($line = mysql_fetch_array($more_views)) 
		{ 
			$topic = append_sid("viewtopic.php?t=".$line['topic_id']); 

	$template->assign_block_vars('pop', array( 
		'TOPIC' => $topic, 
		'POST' => $line['topic_title'], 
		'NB' => $line['topic_views'])); 
	}; 
// fin du sujet le plus populaire

?>
styles/prosilver/template/top5_index.html

Code: Select all

<br />
<div class="forabg"> 
	<div class="inner">
		<span class="corners-top"><span></span></span>
		<ul class="block">
				<dl>
					<dt></dt>
				</dl>
		</ul>
<table cellSpacing="1" cellPadding="0" width="100%" align="center" class="bg2"> 
<tr> 
	<th colspan="2"><div align="center">{L_TOP5_REPLY}</div></th> 
	<th colspan="2"><div align="center">{L_TOP5_LAST_MEMBER}</div></th> 
	<th colspan="2"><div align="center">{L_TOP5_LAST_REPLY}</div></th> 
</tr> 
<tr> 
	<td align="center"  class="row3"><div align="center"><span class="gen">{L_TOP5_NAME}</span></div></td>
	<td align="center"  class="row3"><div align="center"><span class="gen">{L_TOP5_NUMBER}</span></div></td>
	<td align="center"  class="row3"><div align="center"><span class="gen">{L_TOP5_NAME}</span></div></td>
	<td align="center"  class="row3"><div align="center"><span class="gen">{L_TOP5_JOINED}</span></div></td>
	<td align="center"  class="row3"><div align="center"><span class="gen">{L_TOP5_TOPIC}</span></div></td>
	<td align="center"  class="row3"><div align="center"><span class="gen">{L_TOP5_NUMBER_VIEW}</span></div></td>
    <td align="center"  class="row3"><div align="center"><span class="gen">{L_TOP5_EXP2}</span></div></td>
</tr> 
<!-- BEGIN mini --> 
	<!-- IF mini.S_ROW_COUNT is even -->
	<tr class="row1">
	<!-- ELSE -->	
	<tr class="row2">
	<!-- ENDIF -->
<tr> 
	<td align="left" class="row1"><div align="center"><span class="gen">
	  <a href="{mini.POSTER}"><span class="genmed2"><strong><font color="#{mini.USERNAME_COLOR}">{mini.POSTERA}</font></strong></a></span></div></td>
	<td align="center" class="row1"><div align="center"><span class="gen">{mini.NBPOSTS}</span></div></td>
		
	<td align="left" class="row1"><div align="center"><span class="gen">
	  <a href="{mini.NEWMB}"><span class="genmed2"><strong><font color="#{mini.USERNAME_COLOR2}">{mini.NBNAME}</font></strong></a></span></div></td>
	<td align="center" class="row1"><div align="center"><span class="gen">{mini.JOINED}</span></div></td>
	<td align="center" class="row1"><div align="center"><span class="gen"><a href="{mini.TOPIC}">{mini.NOM}</a></span></div></td>
	<td align="left" class="row1">
	  <div align="center"><a href="{mini.POSTER_ID}"><span class="gen"><strong><font color="#{mini.ID_COLOR}">{mini.ID}</font></strong></a></div></td>
    <td align="left"  class="row1"><div align="center"><span class="gen">{mini.IDV}</span></div></td>
</tr> 
<!-- END mini --> 
<!-- BEGIN pop --> 
<tr> 
	<td colspan="6" align="center" class="row2"><span class="gen">{L_TOP5_EXP}<a href="{pop.TOPIC}">{pop.POST}</a> {pop.NB}{L_TOP5_EXP3}{L_TOP5_EXP2}</span></td>
</tr> 
<!-- END pop --> 
</table>
</dd>
				</dl>
			</li>
		</ul>
		<span class="corners-bottom"><span></span></span>
	</div>
</div>



thanks.
If you are requesting me to adapt this MOD to fit to mine... well, at the present time I do have different priorities.

Feel free to post your request at my demo-board, it will be back online maybe tonight (I'm still upgrading it).

Thank you. :)
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
✒️ Black Friday 2019 @ The Studio ▪️◾️

User avatar
BizimPencere
Registered User
Posts: 396
Joined: Sat Aug 25, 2007 8:31 pm

Re: [BETA] IP Country Flag Olympus 0.5.0a [phpBB 3.0.4] + SVN

Post by BizimPencere » Fri Jan 09, 2009 1:37 pm

Nice work thanks.
www.phpbbturkiye.net | Turkish phpBB3 support and development

User avatar
3Di
Former Team Member
Posts: 14477
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: [BETA] IP Country Flag Olympus 0.5.0a [phpBB 3.0.4] + SVN

Post by 3Di » Sat Jan 10, 2009 12:26 am

BizimPencere wrote:Nice work thanks.
Thank you. :)
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
✒️ Black Friday 2019 @ The Studio ▪️◾️

User avatar
3Di
Former Team Member
Posts: 14477
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: [BETA] IP Country Flag Olympus 0.5.0a [phpBB 3.0.4] + SVN

Post by 3Di » Tue Jan 13, 2009 5:13 pm

The SVN link has been updated in the first Post of this Topic.

http://ip-cf-olympus.googlecode.com/svn/trunk

Notice the SVN version can be only discussed at my demo board. Thanks. :)
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
✒️ Black Friday 2019 @ The Studio ▪️◾️

SqueeSr
Registered User
Posts: 8
Joined: Fri May 16, 2008 4:05 pm

Re: [BETA] IP Country Flag Olympus 0.5.0a [phpBB 3.0.4] + SVN

Post by SqueeSr » Sat Mar 14, 2009 3:16 am

Hereby I offer something to the author of this mod, and others that wish to use it. First code I ever posted for the phpbb community. I hope i stuck to the coding rules good enough.

Changes:
This is a modified version of the "db_update.php" script. The reason was that I did not want to be dependent on a new release of the mob to update the IP to Country table.

I have adjusted the script in a few ways:
  • Most important: It imports files from a different format. It uses the IP database freely available on software77. They update this file daily.
  • It uses the script timeout to determine when to stop processing and output HTML for a refresh. It will refresh either at 80% of the max_execution_time or the "user" defined max time set to 15, which ever is the shortest period.
  • Added grooovy progress bar under the progress report :)
Once I have figured out how the unzip function within phpbb works, ill try to add a function that can download the file automatically if possible on the server.

I have tested this on my own server that runs on php 5.2.9 and MySQL 5.0.77.

Instructions:
  • Copy this code into the file "db_update77.php" or any filename you like that should be placed in the install_ip folder that comes along with this mod.
  • Download and unzip the file on software77.net ( d/l link in the column on the right ) and place the file "IpToCountry.csv".
db_update77.php

Code: Select all

<?php
/** 
*
* @package install
* @version $Id: ip_cf_olympus_db_update77.php,v 1.003 2009/13/14 04:00:00 3Di Exp $
* @copyright (c) 2007, 2008, 2009 -  3Di (Marco T.) 
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/
define('IN_PHPBB', true);

$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include_once($phpbb_root_path . 'common.'.$phpEx);


// Session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

// here we check if the user has already modified the board, else stop.
if( !defined('CF_ISO_TABLE') )
{
	trigger_error($user->lang['TABLE_DOES_NOT_EXISTS']);
}


// Page Title
page_header($user->lang['IP_CF_DB_POP_HEADER']);

// first you need to login here, if you are a guest
if ($user->data['user_id'] == ANONYMOUS)
{
	login_box("install_ip/db_update.$phpEx", $user->lang['LOGIN_ADMIN'], $user->lang['LOGIN_ADMIN_SUCCESS']);
}

// no FOUNDER? no party! o_O
if ($user->data['user_type'] != USER_FOUNDER)
{
	$message = $user->lang['NO_FOUNDER'] . '<br /><br />' . sprintf($user->lang['CLICK_RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
	trigger_error($message);
}

//
// This is the file that contains all IP to Country data.
// It should be located in the same directory where this script lives.
//
$datafile 	= 'IpToCountry.csv';
$filesize		= filesize($datafile);

//
// time the script to stop in time
// check to see if time_limit is under 10 ( aka $max_time_limit ) second and if so
// set the time to 80% of the limit 
//
$max_time_limit = 15;
$script_started_at = microtime(true);
$time_limit = ini_get( 'max_execution_time' );
$time_limit = ($time_limit > $max_time_limit) ? $max_time_limit : 0.8 * $time_limit;

//
// INSERT Mask
$insert_mask = 'INSERT INTO '.CF_ISO_TABLE.' ( ip_from, ip_to, iso3661_1, ip_prefix ) VALUES ( %u, %u, \'%s\', "" )';

//
// Check input args
//
$confirm		= isset($_POST['confirm']) ? true : false;
$autorefresh	= isset($_POST['autorefresh']) ? true : false;
$start			= isset($_POST['start']) ? intval($_POST['start']) : 0;
$end			= $start;


// Borrowed from Olympus CVS http://phpbb.cvs.sourceforge.net/phpbb/phpBB2/install/index.php?r1=1.58&r2=1.59
// Try to override some limits - maybe it helps some...

@set_time_limit(0);
@ini_set('memory_limit', '128M');
$mem_limit = @ini_get('memory_limit');
if (!empty($mem_limit))
{
	$unit = strtolower(substr($mem_limit, -1, 1));
	$mem_limit = (int)$mem_limit;
	if ($unit == 'k')
	{
		$mem_limit = floor($mem_limit/1024);
	}
	elseif ($unit == 'g')
	{
		$mem_limit *= 1024;
	}
	elseif (is_numeric($unit))
	{
		$mem_limit = floor($mem_limit/1048576);
	}
	$mem_limit = max(128, $mem_limit) . 'M';
}
else
{
	$mem_limit = '128M';
}
@ini_set('memory_limit', $mem_limit );

// END: Borrowed from Olympus CVS http://phpbb.cvs.sourceforge.net/phpbb/phpBB2/install/index.php?r1=1.58&r2=1.59


//
// Should we update the database now?
//
if ($confirm)
{
	if ($start == 0 && !$db->sql_query('TRUNCATE TABLE ' . CF_ISO_TABLE .''))
	{
		trigger_error($user->lang['FAILED_TO_UPDATE_THE_IP_TO_COUNTRY_TABLE']);
	}
	
	$fp = fopen($datafile, 'rb');
	if (!$fp) 
	{
		echo 'Can\'t open the file.';
		exit;
	}
	fseek($fp, $start, SEEK_SET);
	
	//
	// Parse $max ammount of lines from the csv
	// or until near the script timeout
	//
	$insert_count = 0;
	while (!feof( $fp ) && (microtime(true) - $script_started_at) < $time_limit) {
		if (!($data = fgetcsv($fp, 1024, ','))) 
		{
			continue;	// failed to get a line
		}
		if (count($data) != 7) 
		{
			continue;	// not the expected column count
		}
		if (!is_numeric($data[ 0 ]) || !is_numeric($data[ 1 ]) || strlen($data[ 4 ]) != 2) {			
			continue;	// not the expected variable types
		}
		
		$ip_from	= $data[ 0 ];
		$ip_to		= $data[ 1 ];
		$iso3661_1	= $data[ 4 ];
		
		$sql = sprintf($insert_mask, doubleval($ip_from), doubleval($ip_to), $iso3661_1);
		if(!$db->sql_query($sql))
		{
			trigger_error($user->lang['FAILED_TO_UPDATE_THE_IP_TO_COUNTRY_TABLE']);
		}
		$insert_count++;
	}
	
	$end = ftell($fp);
}

//
// create a status report
//
if($end != 0 && $start == $end)
{
	// 
	// status report: completed
	//
	$autorefresh = false;
	$status_report = '<strong>Completed Import</strong>';
}
else if($end != 0) 
{
	// 
	// status report: in progress
	//
	$perc = 100 * $end / $filesize;
	$col_background	= '#' . dechex(15 - 0.08 * $perc).'00'; // total possible range is 0-15
	$col_progress = '#0' . dechex(7 + 0.08 * $perc) .'0';  // total possible range is 0-15
	$status_report = 'Processed ' . $insert_count . ' records in ' 
				  . number_format(microtime(true) - $script_started_at, 1) 
				  . ' seconds. <br /><br />'
				  .	'Processed <strong>' 
				  . number_format($end / 1024) . 'kb of ' 
				  . number_format($filesize / 1024) . 'kb</strong> ( ' 
				  . number_format($perc, 1). '% ) in total.<br />'
				  .	'<div style="padding:0; border:1px solid; height: 20px; background-color: ' . $col_background . '; width: 100%;">'
				  . '<div style="margin: 0; border:0; height: 20px; background-color: ' . $col_progress . '; width: ' . intVal( $perc ) . '%;">'
				  . '</div>'
				  . '</div>'."\n";
	
}
else 
{
	// 
	// status report: intro / start
	//
	$status_report = '<strong>Click \'Proceed\' to start importing ' 
				   . $datafile . ' ( '
				   . number_format($filesize / 1024) . 'kb )</strong>';
}

//
// Finally, build the installation panel...
//
if($end != 0 && $start == $end) {
	$message .= '<br /><hr />' . "\n"
		. '<table><tr><td><pre>' . $status_report . '</pre></td></tr></table>' . "\n"
		. '<hr /><br />' . "\n"
		. "\n";
}
else 
{
	$message = $user->lang['UPDATE_CONFIRM'];
	if($end == 0)
	{
		$message .= '<br /><br /><strong style="color:blue;">' . $user->lang['BACKUP_WARNING'] . '</strong>' . "\n";
	}

	$message .= '<br /><hr />' . "\n"
		. '<table><tr><td><pre>' . $status_report . '</pre></td></tr></table>' . "\n"
		. '<hr /><br />' . "\n"
		. '<form name="dbupdate" method="post" action="' . append_sid(basename(__FILE__)) . '">' . "\n"
		. '<input class="mainoption" type="submit" name="confirm" value="' . $user->lang['PROCEED'] . '" />' . "\n"
		. '<br /><br />' . "\n"
		. '<label for="autorefresh">' . $user->lang['AUTO_REFRESH'] . '</label>' . "\n"
		. '<input type="checkbox" name="autorefresh" id="autorefresh" value="1"' . ( $autorefresh ? ' checked="checked"' : '' ) . ' />' . "\n"
		. '<input type="hidden" name="start" value="' . ($end) . '" />' . "\n"
		. '</form>' . "\n";
	
	if( $autorefresh )
	{
		$message .= '<script type="text/javascript"><!--' . "\n"
			. 'window.onload = function() {' . "\n"
			. 'setTimeout(\'if(document.forms.dbupdate.autorefresh.checked){document.forms.dbupdate.confirm.click();}\', 1500);' . "\n"
			. '}' . "\n"
			. '//--></script>' . "\n";
	}
}
trigger_error($message);
?>
Hope its usefull to some of you.

User avatar
3Di
Former Team Member
Posts: 14477
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: [BETA] IP Country Flag Olympus 0.5.0a [phpBB 3.0.4] + SVN

Post by 3Di » Fri Mar 20, 2009 10:22 pm

@ SqueeSr: thanks for your interest, but it is a thing I already developed into my own private environment, it takes care of every archive and on and on, ready to be publicly available in a few weeks.

Anyway, the development of this MOD took it's own only one place here.. that's http://gold.io3di.com .. thank all for the interest, though.

Regards, locking this, now. :ugeek:
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
✒️ Black Friday 2019 @ The Studio ▪️◾️

Locked

Return to “[3.0.x] Abandoned MODs”