######################################################## 
## MOD Title:		Forum icons (read/unread) for index.php
## MOD Author:		Sergeant < sergeant@vladmobile.com > http://www.vladivostok.ru/forum4
##
## MOD Description:	Esta modificacion permite al administrador asignar  dos iconos por cada foro
## Uno para cuando existan mensajes nuevos y otro cuando esto no ocurra.
## Los iconos se mostraran en el index.
## Si no se selecciona ningun icono, se mostrar el que viene por default
##
## Author notes: This mod is an improved variant of 'Forum Icon with ACP Control' mod (by Mac (Y.C. LIN)).
##
## Usage: After installation you'll have to put two images (for each forum you would like to modify)
## for both conditions (read/unread) to your root dir (where index.php is located).
## The last thing will be entering the names of those images in forum properties (via admin control panel).
## 
## MOD Traduction: Zuker - www.eddb.com.ar
## 
## Installation Level:	Easy 
## Installation Time:	3 Minutes 
##
## Files To Edit:	5
##	index.php
##	admin/admin_forums.php
##	language/lang_spanish/lang_admin.php
##	templates/subSilver/admin/forum_edit_body.tpl
##	templates/subSilver/index_body.tpl
##
## Included Files: 	n/a
##
################################################################# 
##
## 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/ 
##
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
##############################################################
# 
#-----[ SQL ]------------------------------------------ 
#
# Remember to change the table prefix used on your database
ALTER TABLE `phpbb_forums` ADD `forum_icon_new_post` VARCHAR( 255 ) default NULL;
ALTER TABLE `phpbb_forums` ADD `forum_icon_no_post` VARCHAR( 255 ) default NULL;

#
# Remember to do this for each installed language pack!
#
#-----[ OPEN ]------------------------------------------ 
# 
language/lang_spanish/lang_admin.php

# 
#-----[ FIND ]------------------------------------------ 
#
//
// That's all Folks!
// -------------------------------------------------

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#
//Forum icons
$lang['Forum_icon_new_post'] = 'Icono (nuevos mensajes)';
$lang['Forum_icon_no_post'] = 'Icono (no hay nuevos mensajes)';
//Forum icons

# 
#-----[ OPEN ]------------------------------------------ 
#  
admin/admin_forums.php

# 
#-----[ FIND ]------------------------------------------ 
# 
				$forumstatus = $row['forum_status'];


# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
//Forum icons
				$forumiconnewpost = $row['forum_icon_new_post'];
				$forumiconnopost = $row['forum_icon_no_post'];
//Forum icons
# 
#-----[ FIND ]------------------------------------------ 
# 
				$forumstatus = FORUM_UNLOCKED;

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
//Forum icons
				$forumiconnewpost = '';
				$forumiconnopost = '';
//Forum icons

# 
#-----[ FIND ]------------------------------------------ 
# 
				'L_FORUM_STATUS' => $lang['Forum_status'],

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
//Forum icons
				'L_FORUM_ICON_NEW_POST' => $lang['Forum_icon_new_post'],
				'L_FORUM_ICON_NO_POST' => $lang['Forum_icon_no_post'],
//Forum icons

# 
#-----[ FIND ]------------------------------------------ 
#
				'DESCRIPTION' => $forumdesc)

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
				'DESCRIPTION' => $forumdesc,
//Forum icons
				'ICONNEWPOST' => ( $forumiconnewpost ) ? $forumiconnewpost : '',
				'ICONNEWPOST_DISPLAY' => ( $forumiconnewpost ) ? '<img src="' . $phpbb_root_path . $forumiconnewpost . '" />' : '',

				'ICONNOPOST' => ( $forumiconnopost ) ? $forumiconnopost : '',
				'ICONNOPOST_DISPLAY' => ( $forumiconnopost ) ? '<img src="' . $phpbb_root_path . $forumiconnopost . '" />' : ''
//Forum icons
				)

# 
#-----[ FIND ]------------------------------------------ 
#
			// There is no problem having duplicate forum names so we won't check for it.
			$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
#
forum_status

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
, forum_icon_new_post, forum_icon_no_post

# 
#-----[ FIND ]------------------------------------------ 
#
				VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
#
, " . intval($HTTP_POST_VARS['forumstatus']) . "

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
, '" . str_replace("\'", "''", $HTTP_POST_VARS['forumiconnewpost']) . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumiconnopost']) . "'

# 
#-----[ FIND ]------------------------------------------ 
#
			$sql = "UPDATE " . FORUMS_TABLE . "
				SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
				WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
# 
#-----[ IN-LINE FIND ]------------------------------------------ 
#
, forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . "

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
, forum_icon_new_post = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumiconnewpost']) . "', forum_icon_no_post = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumiconnopost']) . "'

# 
#-----[ FIND ]------------------------------------------ 
# 
					'FORUM_DESC' => $forum_rows[$j]['forum_desc'],

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
//Forum icons
					'FORUM_ICON_NEW_POST_IMG' => ( $forum_rows[$j]['forum_icon_new_post'] ) ? '<img src="' . $phpbb_root_path . $forum_rows[$j]['forum_icon_new_post'] . '" alt="'.$forum_data[$j]['forum_name'].'" title="'.$forum_data[$j]['forum_name'].'" />' : '',
					'FORUM_ICON_NO_POST_IMG' => ( $forum_rows[$j]['forum_icon_no_post'] ) ? '<img src="' . $phpbb_root_path . $forum_rows[$j]['forum_icon_no_post'] . '" alt="'.$forum_data[$j]['forum_name'].'" title="'.$forum_data[$j]['forum_name'].'" />' : '',
//Forum icons

# 
#-----[ OPEN ]------------------------------------------ 
#  
index.php

# 
#-----[ FIND ]------------------------------------------ 
# 
								$folder_image = ( $unread_topics ) ? $images['forum_new'] : $images['forum']; 
								$folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts']; 
							}
# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
                                $folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts']; 
                                if($forum_data[$j]['forum_icon_new_post']) {
					$folder_image = ( $unread_topics ) ? '<img src="' . $phpbb_root_path . $forum_data[$j]['forum_icon_new_post'] . '" alt="'.$forum_data[$j]['forum_name'].' - '.$folder_alt.'" title="'.$forum_data[$j]['forum_name'].' - '.$folder_alt.'">' : '<img src="' . $phpbb_root_path . $forum_data[$j]['forum_icon_no_post'] . '" alt="'.$forum_data[$j]['forum_name'].' - '.$folder_alt.'" title="'.$forum_data[$j]['forum_name'].' - '.$folder_alt.'">';
                                } else{
                                    $folder_image = ( $unread_topics ) ? '<img src="'.$images['forum_new'].'" alt="'.$folder_alt.'" title="'.$folder_alt.'" />' : '<img src="'.$images['forum'].'" alt="'.$folder_alt.'" title="'.$folder_alt.'" />';
                                };
							}

#
# Remember to do this for each installed template!
#
#-----[ OPEN ]------------------------------------------ 
#  
templates/subSilver/admin/forum_edit_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
# 
	<tr> 
	  <td class="row1">{L_FORUM_NAME}</td> 
	  <td class="row2"><input type="text" size="25" name="forumname" value="{FORUM_NAME}" class="post" /></td> 
	</tr> 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	<tr> 
	  <td class="row1">{L_FORUM_ICON_NEW_POST}</td>
	  <td class="row2"><input type="text" size="35" name="forumiconnewpost" value="{ICONNEWPOST}" class="post" />&nbsp;&nbsp;&nbsp;{ICONNEWPOST_DISPLAY}</td>
	</tr>
	</tr>
	<tr> 
	  <td class="row1">{L_FORUM_ICON_NO_POST}</td>
	  <td class="row2"><input type="text" size="35" name="forumiconnopost" value="{ICONNOPOST}" class="post" />&nbsp;&nbsp;&nbsp;{ICONNOPOST_DISPLAY}</td>
	</tr>

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/index_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
# 
<img src="{catrow.forumrow.FORUM_FOLDER_IMG}" width="46" height="25" alt="{catrow.forumrow.L_FORUM_FOLDER_ALT}" title="{catrow.forumrow.L_FORUM_FOLDER_ALT}" />

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
{catrow.forumrow.FORUM_FOLDER_IMG}

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 

# EoM