############################################################## 
## MOD Title:          AJAX features
## MOD Author:         alcaeus < mods@alcaeus.org > (N/A) http://www.alcaeus.org
## MOD Description:    This MOD introduces a lot of features based on the AJAX 
##                     technology. For more details, see features.txt
## MOD Version:        1.0.1
##
## Traduccion Espaol: ThE KuKa - http://www.phpbb-es.com
##
## Installation Level: Advanced
## Installation Time:  45-60 Minutes (1mn by EasyMOD of Nuttzy)
## Files To Edit:      33
##      admin/page_header_admin.php
##      includes/constants.php
##      includes/functions.php
##      includes/functions_search.php
##      includes/page_header.php
##      includes/usercp_register.php
##      language/lang_english/lang_main.php
##      language/lang_spanish/lang_main.php
##      templates/subSilver/admin/group_edit_body.tpl
##      templates/subSilver/admin/page_header.tpl
##      templates/subSilver/admin/user_ban_body.tpl
##      templates/subSilver/admin/user_select_body.tpl
##      templates/subSilver/groupcp_info_body.tpl
##      templates/subSilver/index_body.tpl
##      templates/subSilver/modcp_body.tpl
##      templates/subSilver/overall_header.tpl
##      templates/subSilver/posting_body.tpl
##      templates/subSilver/profile_add_body.tpl
##      templates/subSilver/search_results_posts.tpl
##      templates/subSilver/search_results_topics.tpl
##      templates/subSilver/search_username.tpl
##      templates/subSilver/simple_header.tpl
##      templates/subSilver/viewforum_body.tpl
##      templates/subSilver/viewtopic_body.tpl
##      templates/subSilver/viewtopic_poll_ballot.tpl
##      templates/subSilver/viewtopic_poll_result.tpl
##      index.php
##      modcp.php
##      posting.php
##      privmsg.php
##      search.php
##      viewforum.php
##      viewtopic.php
##
## Included Files:     9
##      includes/javascript/ajax_core.js
##      includes/javascript/ajax_forumfunctions.js
##      includes/javascript/ajax_postfunctions.js
##      includes/javascript/ajax_regfunctions.js
##      includes/javascript/ajax_searchfunctions.js
##      includes/javascript/ajax_topicfunctions.js
##      includes/javascript/index.htm
##      templates/subSilver/ajax_result.tpl
##      ajax.php
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 
############################################################## 
## For security purposes, please check: http://www.phpbb.com/mods/ 
## for the latest version of this MOD. Although MODs are checked 
## before being allowed in the MODs Database there is no guarantee 
## that there are no security problems within the MOD. No support 
## will be given for MODs not found within the MODs Database which 
## can be found at http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes: 
## 
## 1. MOD Compatibility
## -----------
## This MOD has been successfully tested on phpBB 2.0.20. This MOD will not 
## work on versions before 2.0.20, as some crucial functions are missing. 
## Furthermore, you should always keep your installation of phpBB up to date. 
## To get the newest version of phpBB, go to http://www.phpbb.com/downloads.php
## If you don't have phpBB 2.0.20, upgrade now BEFORE updating or installing 
## this MOD; you won't find some of the instructions
## 
## 2. MOD Installation
## -----------
## There are two ways to install MODs into your phpBB:
## 
## 2.1. Installation with EasyMOD (EM)
## -----------
## Note that EM does not manage translations. Therefore, this file only 
## contains instructions for english language files. For other language strings
## see the translations-folder or contact me, if your language is missing.
## Translations are always appreciated
## 
## 2.2. Manual Installation
## -----------
## EM might fail on very heavily modded boards. Therefore it's possible that 
## you have to do the install manually. Also, if you don't like using EM for 
## whatever reason, you'll have to perform the update instructions yourself. 
## If you're unfamiliar with the process of installing a MOD, please use this 
## document: http://www.phpbb.com/kb/article.php?article_id=150
## 
## 3. MOD Support
## -----------
## Ok, general rule of thumb: ask for support on the site where you got the 
## MOD. This is either on my site (*.alcaeus.org), on phpbb.com, phpbb.de or 
## phpbb2.de (Note that a MOD may not have been released on all of the listed 
## sites, but those are the ones I trust). If you have downloaded the MOD from 
## any other location, please contact me via eMail and I'll take care of it.
## You should not install MODs downloaded from other sources than the ones 
## mentioned above.
## Also, if you are using a system other than phpBB (i.e. Orion, phpBB Plus, 
## etc.) you will NOT, I repeat, NOT get support, so please do not ask. I only 
## accept bug reports that are reproducable in the current version of phpBB, 
## but not bugs that only appear in premodded versions; ask where you got the 
## premod. Topics asking for support/and bug reports which don't affect phpBB 
## will be locked on sight. You've been warned!
## 
## 4. Contact
## -----------
## First: do not contact me via PM or eMail asking for support. Be ready to be 
## ignored in that case. If you need support, see chapter 2. There is only one 
## reason for you to contact me via eMail or PM: you want to build a MOD based 
## on the code of one of my MODs and redistribute it. In that case, I request 
## you ask for my permission for re-usage and re-release of my code.
##
## 5. Official last version link
## -----------
## You can see the MOD in action and download the newest version at the 
## ajax_features demo area, which can be found at 
## http://demoarea.alcaeus.org/ajax_features
##
############################################################## 
## MOD History: 
##
##   2006-04-19 - Version 1.0.1
##      - [fix] Fixed bug in AJAX vote - could still vote in expired polls
##      - [fix] Fixed bug with + in QuickEdit and QuickPreview, reported and 
##        fix provided by John Doe, oxpus and cback
##      - [fix] Fixed bug with UTF-8 characters in QuickEdit and QuickPreview
##        Thanks to markus_petrux for hinting a fix
##      - [fix] Fixed bug with post texts being truncated to 4096 Bytes when 
##        sent back to some Browsers (John Doe)
##      - [change] Changed search results to show results as posts by default
##        (beedy)
##      - [change] Used phpBB defined constants for parameter names in 
##        Javascript (phpBB MOD Team)
##      - [change] Used phpBB defined variable for php file extension (phpBB 
##        MOD team)
##      - [change] Bypass errors caused by phpBB 2.0.20's search flood 
##        protection. The MOD now requires version 2.0.20!
##      - [change] Limit length for topic title in AJAX edit fields (John Doe)
##      - [change] Scroll to top when using the quick preview feature 
##        (kroetenmist)
##      - [new] Provided link to go from poll results to poll ballot, if the 
##        user has not voted (works in AJAX and classic modes)
##
##   2006-02-04 - Version 1.0.0
##      - Initial stable release
##
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 
# 
#-----[ COPY ]------------------------------------------------ 
# 
copy /root/ajax.php to /ajax.php
copy /root/includes/javascript/ajax_core.js to /includes/javascript/ajax_core.js
copy /root/includes/javascript/ajax_forumfunctions.js to /includes/javascript/ajax_forumfunctions.js
copy /root/includes/javascript/ajax_postfunctions.js to /includes/javascript/ajax_postfunctions.js
copy /root/includes/javascript/ajax_regfunctions.js to /includes/javascript/ajax_regfunctions.js
copy /root/includes/javascript/ajax_searchfunctions.js to /includes/javascript/ajax_searchfunctions.js
copy /root/includes/javascript/ajax_topicfunctions.js to /includes/javascript/ajax_topicfunctions.js
copy /root/includes/javascript/index.htm to /includes/javascript/index.htm
copy /root/templates/subSilver/ajax_result.tpl to /templates/subSilver/ajax_result.tpl


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
	'PAGE_TITLE' => $page_title,


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	'PHPBB_ROOT_PATH' => $phpbb_root_path,
	'PHPEX' => $phpEx,


# 
#-----[ FIND ]------------------------------------------------ 
# 
	'S_CONTENT_DIR_RIGHT' => $lang['RIGHT'], 


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	'S_SID' => $userdata['session_id'],


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
define('AUTH_ATTACH', 11);


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
// Constants for AJAX
// !!! DO NOT CHANGE THESE VALUES UNLESS YOU CHANGE THE JS-FILES AS WELL !!!
define('AJAX_OP_COMPLETED', 0);
define('AJAX_ERROR', 1);
define('AJAX_CRITICAL_ERROR', 2);
define('AJAX_POST_SUBJECT_EDITED', 3);
define('AJAX_POST_TEXT_EDITED', 4);
define('AJAX_POLL_RESULT', 5);
define('AJAX_WATCH_TOPIC', 6);
define('AJAX_LOCK_TOPIC', 7);
define('AJAX_MARK_TOPIC', 8);
define('AJAX_MARK_FORUM', 9);
define('AJAX_PM_USERNAME_FOUND', 10);
define('AJAX_PM_USERNAME_SELECT', 11);
define('AJAX_PM_USERNAME_ERROR', 12);
define('AJAX_PREVIEW', 13);


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
?>


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
function AJAX_headers()
{
	//No caching whatsoever
	header('Content-Type: application/xml');
	header('Expires: Thu, 15 Aug 1984 13:30:00 GMT');
	header('Last-Modified: '. gmdate('D, d M Y H:i:s') .' GMT');
	header('Cache-Control: no-cache, must-revalidate');  // HTTP/1.1
	header('Pragma: no-cache');                          // HTTP/1.0
}

function AJAX_message_die($data_ar)
{
	global $template, $db;
	
	if (!headers_sent())
	{
		AJAX_headers();
	}
	
	$template->set_filenames(array(
		'ajax_result' => 'ajax_result.tpl')
	);
	
	foreach($data_ar as $key => $value)
	{
		if ($value !== '')
		{
			$value = utf8_encode(htmlspecialchars($value));
			// Get special characters in posts back ;)
			$value = preg_replace('#&amp;\#(\d{1,4});#i', '&#\1;', $value);
			
			$template->assign_block_vars('tag', array(
				'TAGNAME' => $key,
				'VALUE' => $value)
			);
		}
	}
	
	$template->pparse('ajax_result');
	
	$db->sql_close();
	exit;
}

// This function is taken from includes/bbcode.php and renamed
// We need this in special occasions
function unhtmlspecialchars($text)
{
	$text = preg_replace("/&gt;/i", ">", $text);
	$text = preg_replace("/&lt;/i", "<", $text);
	$text = preg_replace("/&quot;/i", "\"", $text);
	$text = preg_replace("/&amp;/i", "&", $text);

	return $text;
}

/**
* RFC1738 compliant replacement to PHP's rawurldecode - which actually works with unicode (using utf-8 encoding)
* @author Ronen Botzer
* @param $source [STRING]
* @return unicode safe rawurldecoded string [STRING]
* @access public
*/
function utf8_rawurldecode($source)
{
	// Strip slashes
	$source = stripslashes($source);
	
	$decodedStr = '';
	$pos = 0;
	$len = strlen ($source);
	
	while ($pos < $len)
	{
		$charAt = substr($source, $pos, 1);
		if ($charAt == '%')
		{
			$pos++;
			$charAt = substr($source, $pos, 1);
			if ($charAt == 'u')
			{
				// we got a unicode character
				$pos++;
				$unicodeHexVal = substr($source, $pos, 4);
				$unicode = hexdec($unicodeHexVal);
				$entity = "&#". $unicode .';';
				$decodedStr .= utf8_encode($entity);
				$pos += 4;
			}
			else
			{
				// we have an escaped ascii character
				$hexVal = substr ($source, $pos, 2);
				$decodedStr .= chr (hexdec ($hexVal));
				$pos += 2;
			}
		}
		else
		{
			$decodedStr .= $charAt;
			$pos++;
		}
	}

	// Add slashes before sending it back to the browser; 
	// this keeps people from trying to inject SQL with some malformed string like %2527
	return addslashes($decodedStr);
}

// Used to escape AJAX data correctly.
// functions_post.php must be included before calling this function
function ajax_htmlspecialchars($text)
{
	global $html_entities_match, $html_entities_replace;
	
	return preg_replace($html_entities_match, $html_entities_replace, $text);
}


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
function remove_search_post($post_id_sql)


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
)


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
, $remove_subject = True, $remove_message = True


# 
#-----[ FIND ]------------------------------------------------ 
# 
	switch ( SQL_LAYER )


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
	$where_sql = '';
	if (!$remove_subject || !$remove_message)
	{
		$where_sql = ' AND title_match = '. (($remove_subject) ? 1 : 0);
	}
	


# 
#-----[ FIND ]------------------------------------------------ 
# 
		case 'mysql4':
			$sql = "SELECT word_id 
				FROM " . SEARCH_MATCH_TABLE . " 
				WHERE post_id IN ($post_id_sql) 


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
				$where_sql 


# 
#-----[ FIND ]------------------------------------------------ 
# 
				$sql = "SELECT word_id 
					FROM " . SEARCH_MATCH_TABLE . " 
					WHERE word_id IN ($word_id_sql) 


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
					$where_sql 


# 
#-----[ FIND ]------------------------------------------------ 
# 
					WHERE word_id IN ( 
						SELECT word_id 
						FROM " . SEARCH_MATCH_TABLE . " 
						WHERE post_id IN ($post_id_sql) 


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
						$where_sql 


# 
#-----[ FIND ]------------------------------------------------ 
# 
					GROUP BY word_id 
					HAVING COUNT(word_id) = 1
				)"; 
			if ( !$db->sql_query($sql) )


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
					$where_sql 


# 
#-----[ FIND ]------------------------------------------------ 
# 
		WHERE post_id IN ($post_id_sql)";


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
";


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# Note the leading space!
 $where_sql
 

# 
#-----[ FIND ]------------------------------------------------ 
# 
	global $starttime, $gen_simple_header;


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
;


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
, $userdata


# 
#-----[ FIND ]------------------------------------------------ 
# 
	if ( $username_list != '' )
	{
		$template->assign_block_vars('switch_select_name', array());


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
	if ( $username_list == '' )
	{
		$template->assign_var('USERNAME_LIST_VIS', 'style="display:none;"');


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
if ( $board_config['gzip_compress'] )


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# Note the leading space!
 )


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
 && !defined('AJAX_HEADERS')


# 
#-----[ FIND ]------------------------------------------------ 
# 
	'SITE_DESCRIPTION' => $board_config['site_desc'],


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	'PHPBB_ROOT_PATH' => $phpbb_root_path,
	'PHPEX' => $phpEx,
	'POST_FORUM_URL' => POST_FORUM_URL,
	'POST_TOPIC_URL' => POST_TOPIC_URL,
	'POST_POST_URL' => POST_POST_URL,


# 
#-----[ FIND ]------------------------------------------------ 
# 
	'S_LOGIN_ACTION' => append_sid('login.'.$phpEx),


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	'S_SID' => $userdata['session_id'],


# 
#-----[ FIND ]------------------------------------------------ 
# 
if (!empty($HTTP_SERVER_VARS['SERVER_SOFTWARE']) && strstr($HTTP_SERVER_VARS['SERVER_SOFTWARE'], 'Apache/2'))


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
if (!defined('AJAX_HEADERS'))
{


# 
#-----[ FIND ]------------------------------------------------ 
# 
header ('Pragma: no-cache');


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
}


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
		'L_EMAIL_ADDRESS' => $lang['Email_address'],


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
		'L_PASSWORD_MISMATCH' => $lang['Password_mismatch'],


# 
#-----[ OPEN ]------------------------------------------------ 
# 
language/lang_english/lang_main.php


# 
#-----[ FIND ]------------------------------------------------ 
# 
$lang['View_results'] = 'View Results';


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
$lang['View_ballot'] = 'View Ballot';


# 
#-----[ FIND ]------------------------------------------------ 
# 
$lang['Total_votes'] = 'Total Votes';


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
$lang['Full_edit'] = 'Switch to full edit form';
$lang['Save_changes'] = 'Save';
$lang['No_subject'] = '(No subject)';


# 
#-----[ FIND ]------------------------------------------------ 
# 
$lang['Styles_tip'] = 'Tip: Styles can be applied quickly to selected text.';


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
$lang['AJAX_search_results'] = 'A quick search has found %s topics with the keywords in your topic title. Click here to view these topics';
$lang['AJAX_search_result'] = 'A quick search has found one topic with the keywords in your topic title. Click here to view this topic';


# 
#-----[ FIND ]------------------------------------------------ 
# 
$lang['Click_view_privmsg'] = 'Click %sHere%s to visit your Inbox';


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
$lang['More_matches_username'] = 'More than one username matched your query. Please select a user from the box above.';
$lang['No_username'] = 'You must enter a username.';

# 
#-----[ OPEN ]------------------------------------------------ 
# 
language/lang_spanish/lang_main.php


# 
#-----[ FIND ]------------------------------------------------ 
# Busqueda parcial, esta linea acaba en punto y coma ;
$lang['View_results']


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
$lang['View_ballot'] = 'Ver Votacion';


# 
#-----[ FIND ]------------------------------------------------ 
# Busqueda parcial, esta linea acaba en punto y coma ;
$lang['Total_votes']


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
$lang['Full_edit'] = 'Cambiar para corregir por completo el formulario';
$lang['Save_changes'] = 'Guardar';
$lang['No_subject'] = '(Sin Asunto)';


# 
#-----[ FIND ]------------------------------------------------ 
# Busqueda parcial, esta linea acaba en punto y coma ;
$lang['Styles_tip']


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
$lang['AJAX_search_results'] = 'Una bsqueda rpida ha encontrado %s Temas con las palabras claves en tu ttulo del Tema. Clic aqu para ver estos Temas';
$lang['AJAX_search_result'] = 'Una bsqueda rpida ha encontrado un Tema con las palabras claves en tu ttulo del Tema. Clic aqu para ver este Tema';


# 
#-----[ FIND ]------------------------------------------------ 
# Busqueda parcial, esta linea acaba en punto y coma ;
$lang['Click_view_privmsg']


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
$lang['More_matches_username'] = 'Ms de un usuario se encontro con su consulta. Por favor seleccione a un usuario de la caja de arriba.';
$lang['No_username'] = 'Usted debe introducir un nombre de usuario.';

# 
#-----[ OPEN ]------------------------------------------------ 
# 
templates/subSilver/admin/group_edit_body.tpl


# 
#-----[ FIND ]------------------------------------------------ 
# 

<h1>{L_GROUP_TITLE}</h1>


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
<script type="text/javascript" src="../includes/javascript/ajax_searchfunctions.js"></script>
<script type="text/javascript">
<!--
last_username = '{GROUP_MODERATOR}';
//-->
</script>


# 
#-----[ FIND ]------------------------------------------------ 
# 
	  <td class="row2" width="62%"><input class="post" type="text" class="post" name="username" maxlength="50" size="20" value="{GROUP_MODERATOR}" /> &nbsp; <input type="submit" name="usersubmit" value="{L_FIND_USERNAME}" class="liteoption" onClick="window.open('{U_SEARCH_USER}', '_phpbbsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" /></td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
name="username"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 id="username"


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
value="{GROUP_MODERATOR}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 onkeyup="AJAXUsernameSearch(this.value, 0);"


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
&nbsp; <input type="submit"


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
<span id="username_list" style="display:none;"><span id="username_select">&nbsp;</span>&nbsp;</span>


# 
#-----[ FIND ]------------------------------------------------ 
# 
	<tr> 
	  <td class="row1" width="38%"><span class="gen">{L_GROUP_STATUS}:</span></td>


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
	<tr id="username_error_tbl" style="display:none;">
	  <td class="row1">&nbsp;</td>
		<td class="row2" id="username_error_text">&nbsp;</td>
	</tr>


# 
#-----[ OPEN ]------------------------------------------------ 
# 
templates/subSilver/admin/page_header.tpl


# 
#-----[ FIND ]------------------------------------------------ 
# 
</head>


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
<script type="text/javascript">
<!--
var S_SID = '{S_SID}';
var ajax_core_defined = 0;
var phpbb_root_path = '{PHPBB_ROOT_PATH}';
var phpEx = '{PHPEX}';
//-->
</script>

<script type="text/javascript" src="../includes/javascript/ajax_core.js"></script>


# 
#-----[ OPEN ]------------------------------------------------ 
# 
templates/subSilver/admin/user_ban_body.tpl


# 
#-----[ FIND ]------------------------------------------------ 
# 

<h1>{L_BAN_TITLE}</h1>


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
<script type="text/javascript" src="../includes/javascript/ajax_searchfunctions.js"></script>


# 
#-----[ FIND ]------------------------------------------------ 
# 
	  <td class="row2"><input class="post" type="text" class="post" name="username" maxlength="50" size="20" /> <input type="hidden" name="mode" value="edit" />{S_HIDDEN_FIELDS} <input type="submit" name="usersubmit" value="{L_FIND_USERNAME}" class="liteoption" onClick="window.open('{U_SEARCH_USER}', '_phpbbsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" /></td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
name="username"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 id="username"


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
maxlength="50" size="20"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 onkeyup="AJAXUsernameSearch(this.value, 0);"


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
<input type="hidden"


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
<span id="username_list" style="display:none;"><span id="username_select">&nbsp;</span>&nbsp;</span>


# 
#-----[ FIND ]------------------------------------------------ 
# 
	<tr> 
	  <th class="thHead" colspan="2">{L_UNBAN_USER}</th>


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
	<tr id="username_error_tbl" style="display:none;">
	  <td class="row1">&nbsp;</td>
	  <td class="row2" id="username_error_text">&nbsp;</td>
	</tr>


# 
#-----[ OPEN ]------------------------------------------------ 
# 
templates/subSilver/admin/user_select_body.tpl


# 
#-----[ FIND ]------------------------------------------------ 
# 

<h1>{L_USER_TITLE}</h1>


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
<script type="text/javascript" src="../includes/javascript/ajax_searchfunctions.js"></script>


# 
#-----[ FIND ]------------------------------------------------ 
# 
		<td class="row1" align="center"><input type="text" class="post" name="username" maxlength="50" size="20" /> <input type="hidden" name="mode" value="edit" />{S_HIDDEN_FIELDS}<input type="submit" name="submituser" value="{L_LOOK_UP}" class="mainoption" /> <input type="submit" name="usersubmit" value="{L_FIND_USERNAME}" class="liteoption" onClick="window.open('{U_SEARCH_USER}', '_phpbbsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" /></td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
name="username"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 id="username"


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
maxlength="50" size="20"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 onkeyup="AJAXUsernameSearch(this.value, 0);"


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
<input type="hidden"


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
<span id="username_list" style="display:none;"><span id="username_select">&nbsp;</span>&nbsp;</span>


# 
#-----[ FIND ]------------------------------------------------ 
# 
</table></form>


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
	<tr id="username_error_tbl" style="display:none;">
		<td class="row1" id="username_error_text">&nbsp;</td>
	</tr>


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


# 
#-----[ FIND ]------------------------------------------------ 
# 

<form action="{S_GROUPCP_ACTION}" method="post">


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
<script type="text/javascript" src="includes/javascript/ajax_searchfunctions.js"></script>


# 
#-----[ FIND ]------------------------------------------------ 
# 
		<span class="genmed"><input type="text"  class="post" name="username" maxlength="50" size="20" /> <input type="submit" name="add" value="{L_ADD_MEMBER}" class="mainoption" /> <input type="submit" name="usersubmit" value="{L_FIND_USERNAME}" class="liteoption" onClick="window.open('{U_SEARCH_USER}', '_phpbbsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" /></span><br /><br />


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
name="username"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 id="username"


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
maxlength="50" size="20"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 onkeyup="AJAXUsernameSearch(this.value, 0);"


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# Note the leading space!
 <input type="submit" name="add"


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
<span id="username_list" style="display:none;">&nbsp;<span id="username_select">&nbsp;</span></span>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
</span><br /><br />


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
</span><br /><span id="username_error_tbl" style="display:none;"><span id="username_error_text" class="gen">&nbsp;</span>


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
<table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
<script type="text/javascript" src="includes/javascript/ajax_forumfunctions.js"></script>



# 
#-----[ FIND ]------------------------------------------------ 
# 
	<td class="row1" align="center" valign="middle" height="50"><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}" /></td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
height="50">


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# 
{catrow.forumrow.S_MARK_LINK_START}


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
src="{catrow.forumrow.FORUM_FOLDER_IMG}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 id="forumimage_{catrow.forumrow.FORUM_ID}"


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
title="{catrow.forumrow.L_FORUM_FOLDER_ALT}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 border="0"


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
</td>


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
{catrow.forumrow.S_MARK_LINK_END}


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
<form method="post" action="{S_MODCP_ACTION}">


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
<script type="text/javascript" src="includes/javascript/ajax_topicfunctions.js"></script>


# 
#-----[ FIND ]------------------------------------------------ 
# 
	  <td class="row1">&nbsp;<span class="topictitle">{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a></span></td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
<td class="row1"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 ondblclick="AJAXTitleEdit({topicrow.TOPIC_FIRST_POST_ID}, 0)"


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
<a href="{topicrow.U_VIEW_TOPIC}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 id="topiclink_{topicrow.TOPIC_FIRST_POST_ID}"


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
</span></td>


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
<span id="title_{topicrow.TOPIC_FIRST_POST_ID}" style="display:none;"><input type="text" class="post" name="topictitle_{topicrow.TOPIC_FIRST_POST_ID}" id="topictitle_{topicrow.TOPIC_FIRST_POST_ID}" value="{topicrow.TOPIC_TITLE}" size="40" maxlength="60" /><input type="hidden" id="orig_topictitle_{topicrow.TOPIC_FIRST_POST_ID}" value="{topicrow.TOPIC_TITLE}" />&nbsp;<input type="button" onclick="AJAXEndTitleEdit({topicrow.TOPIC_FIRST_POST_ID})" value="{L_SAVE_CHANGES}" class="mainoption" />&nbsp;<input type="button" onclick="AJAXCancelTitleEdit({topicrow.TOPIC_FIRST_POST_ID})" value="{L_CANCEL}" class="liteoption" /></span>


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
<!-- END switch_enable_pm_popup -->


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
<script type="text/javascript">
<!--
var S_SID = '{S_SID}';
var ajax_core_defined = 0;
var phpbb_root_path = '{PHPBB_ROOT_PATH}';
var phpEx = '{PHPEX}';
var POST_FORUM_URL = '{POST_FORUM_URL}';
var POST_TOPIC_URL = '{POST_TOPIC_URL}';
var POST_POST_URL = '{POST_POST_URL}';
//-->
</script>

<script type="text/javascript" src="includes/javascript/ajax_core.js"></script>


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
<script language="JavaScript" type="text/javascript">


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
<script type="text/javascript">
<!--
var L_RESULTS = '{L_SEARCH_RESULTS}';
var L_RESULT = '{L_SEARCH_RESULT}';
var L_MORE_MATCHES = '{L_MORE_MATCHES}';
//-->
</script>

<script type="text/javascript" src="includes/javascript/ajax_postfunctions.js"></script>



# 
#-----[ FIND ]------------------------------------------------ 
# 
{POST_PREVIEW_BOX}


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
<div id="preview_box" {S_DISPLAY_PREVIEW}>{POST_PREVIEW_BOX}</div>


# 
#-----[ FIND ]------------------------------------------------ 
# 
		<td class="row2"><span class="genmed"><input type="text" class="post" tabindex="1" name="username" size="25" maxlength="25" value="{USERNAME}" /></span></td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
value="{USERNAME}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 onblur="AJAXCheckPostUsername(this.value);"


# 
#-----[ FIND ]------------------------------------------------ 
# 
	</tr>


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	<tr id="post_username_error_tbl" style="display:none;">
	  <td class="row1">&nbsp;</td>
	  <td class="row2"><span class="gen" id="post_username_error_text">&nbsp;</span></td>
	</tr>


# 
#-----[ FIND ]------------------------------------------------ 
# 
		<td class="row2"><span class="genmed"><input type="text"  class="post" name="username" maxlength="25" size="25" tabindex="1" value="{USERNAME}" />&nbsp;<input type="submit" name="usersubmit" value="{L_FIND_USERNAME}" class="liteoption" onClick="window.open('{U_SEARCH_USER}', '_phpbbsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" /></span></td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
value="{USERNAME}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 onkeyup="AJAXCheckPMUsername(this.value);"


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
&nbsp;<input type="submit"


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
<span id="pm_username_select">&nbsp;</span>


# 
#-----[ FIND ]------------------------------------------------ 
# 
	</tr>


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	<tr id="pm_username_error_tbl" style="display:none;">
	  <td class="row1">&nbsp;</td>
	  <td class="row2"><span class="gen" id="pm_username_error_text">&nbsp;</span></td>
	</tr>


# 
#-----[ FIND ]------------------------------------------------ 
# 
		<input type="text" name="subject" size="45" maxlength="60" style="width:450px" tabindex="2" class="post" value="{SUBJECT}" />


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
value="{SUBJECT}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 {S_AJAX_BLUR}


# 
#-----[ FIND ]------------------------------------------------ 
# 
	</tr>
	<tr> 


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
	</tr>
	<tr id="subject_error_tbl" style="display:none;">
	  <td class="row1">&nbsp;</td>
	  <td class="row2"><span class="gen">{L_EMPTY_SUBJECT}</span></td>
	</tr>
	<tr id="searchresults_tbl" style="display:none;">
	  <td class="row1">&nbsp;</td>
	  <td class="row2"><span class="gen">
	  	<a href="#" target="_blank" class="gen" id="searchresults_lnk">No results found.</a>
	  </span></td>


# 
#-----[ FIND ]------------------------------------------------ 
# 
	  <td class="catBottom" colspan="2" align="center" height="28"> {S_HIDDEN_FORM_FIELDS}<input type="submit" tabindex="5" name="preview" class="mainoption" value="{L_PREVIEW}" />&nbsp;<input type="submit" accesskey="s" tabindex="6" name="post" class="mainoption" value="{L_SUBMIT}" /></td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
name="preview"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 onclick="return AJAXPreview({S_IS_PM}, {S_EDIT_POST_ID});"


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
<form action="{S_PROFILE_ACTION}" {S_FORM_ENCTYPE} method="post">


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
<script type="text/javascript" src="includes/javascript/ajax_postfunctions.js"></script>
<script type="text/javascript" src="includes/javascript/ajax_regfunctions.js"></script>

<form action="{S_PROFILE_ACTION}" {S_FORM_ENCTYPE} method="post" name="addprofile">


# 
#-----[ FIND ]------------------------------------------------ 
# 
		<td class="row2"><input type="text" class="post" style="width:200px" name="username" size="25" maxlength="25" value="{USERNAME}" /></td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
value="{USERNAME}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 onblur="AJAXCheckPostUsername(this.value);"


# 
#-----[ FIND ]------------------------------------------------ 
# 
	</tr>


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	<tr id="post_username_error_tbl" style="display:none;">
	  <td class="row1">&nbsp;</td>
	  <td class="row2"><span class="gen" id="post_username_error_text">&nbsp;</span></td>
	</tr>


# 
#-----[ FIND ]------------------------------------------------ 
# 
		<td class="row2"><input type="text" class="post" style="width:200px" name="email" size="25" maxlength="255" value="{EMAIL}" /></td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
value="{EMAIL}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 onblur="AJAXCheckEmail(this.value);"


# 
#-----[ FIND ]------------------------------------------------ 
# 
	<!-- BEGIN switch_edit_profile -->


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
	<tr id="email_error_tbl" style="display:none;">
	  <td class="row1">&nbsp;</td>
	  <td class="row2"><span class="gen" id="email_error_text">&nbsp;</span></td>
	</tr>


# 
#-----[ FIND ]------------------------------------------------ 
# 
		<input type="password" class="post" style="width: 200px" name="new_password" size="25" maxlength="32" value="{NEW_PASSWORD}" />


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
value="{NEW_PASSWORD}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 onchange="ComparePasswords(this.value, document.addprofile.password_confirm.value);"


# 
#-----[ FIND ]------------------------------------------------ 
# 
		<input type="password" class="post" style="width: 200px" name="password_confirm" size="25" maxlength="32" value="{PASSWORD_CONFIRM}" />


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
value="{PASSWORD_CONFIRM}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 onchange="ComparePasswords(document.addprofile.new_password.value, this.value);"


# 
#-----[ FIND ]------------------------------------------------ 
# 
	  </td>
	</tr>


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	<tr id="pass_compare_error_tbl" style="display:none;">
	  <td class="row1">&nbsp;</td>
	  <td class="row2"><span class="gen">{L_PASSWORD_MISMATCH}</span></td>
	</tr>


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


# 
#-----[ FIND ]------------------------------------------------ 
# 

<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
<script type="text/javascript" src="includes/javascript/ajax_topicfunctions.js"></script>


# 
#-----[ FIND ]------------------------------------------------ 
# 
	<td class="catHead" colspan="2" height="28"><span class="topictitle"><img src="templates/subSilver/images/folder.gif" align="absmiddle" />&nbsp; {L_TOPIC}:&nbsp;<a href="{searchresults.U_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a></span></td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
>{searchresults.TOPIC_TITLE}</a>


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# Note the leading space!
 id="topiclink_top_{searchresults.U_POST_ID}"


# 
#-----[ FIND ]------------------------------------------------ 
# 
	<td width="100%" valign="top" class="row1"><img src="{searchresults.MINI_POST_IMG}" width="12" height="9" alt="{searchresults.L_MINI_POST_ALT}" title="{searchresults.L_MINI_POST_ALT}" border="0" /><span class="postdetails">{L_FORUM}:&nbsp;<b><a href="{searchresults.U_FORUM}" class="postdetails">{searchresults.FORUM_NAME}</a></b>&nbsp; &nbsp;{L_POSTED}: {searchresults.POST_DATE}&nbsp; &nbsp;{L_SUBJECT}: <b><a href="{searchresults.U_POST}">{searchresults.POST_SUBJECT}</a></b></span></td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
width="100%" valign="top" class="row1"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 {searchresults.S_AJAX_EDIT_TITLE}


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
<img src="{searchresults.MINI_POST_IMG}"


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
<span class="postdetails"><a href="{searchresults.U_POST}">


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
<span class="postdetails">{L_FORUM}


# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
# 
</a>{L_FORUM}


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
<b><a href="{searchresults.U_POST}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 id="topiclink_{searchresults.U_POST_ID}"


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
</span></td>


# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
# You can also delete the text found before, this is just for easyMOD
<!-- /span></td -->


# 
#-----[ FIND ]------------------------------------------------ 
# 
  </tr>
  <tr>


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
	  	<!-- BEGIN can_edit -->
	  	<span id="title_{searchresults.U_POST_ID}" style="display:none;"><input type="text" class="post" name="topictitle_{searchresults.U_POST_ID}" id="topictitle_{searchresults.U_POST_ID}" value="{searchresults.POST_RAW_SUBJECT}" size="40" maxlength="60" onkeyup="AJAXTitleEditKeyUp(event, {searchresults.U_POST_ID})" /><input type="hidden" id="orig_topictitle_{searchresults.U_POST_ID}" value="{searchresults.POST_RAW_SUBJECT}" />&nbsp;<input type="button" onclick="AJAXEndTitleEdit({searchresults.U_POST_ID})" value="{L_SAVE_CHANGES}" class="mainoption" />&nbsp;<input type="button" onclick="AJAXCancelTitleEdit({searchresults.U_POST_ID})" value="{L_CANCEL}" class="liteoption" /></span>
	  	<!-- END can_edit -->
	</span></td>


# 
#-----[ FIND ]------------------------------------------------ 
# 
	<td valign="top" class="row1"><span class="postbody">{searchresults.MESSAGE}</span></td>


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
	<td valign="top" class="row1">
		{searchresults.U_EDIT_IMG}<span id="postmessage_{searchresults.U_POST_ID}"><span class="postbody">{searchresults.MESSAGE}</span></span>
		<!-- BEGIN can_edit -->
		<div class="gen" id="post_{searchresults.U_POST_ID}" style="display:none; text-align:right;">
			<textarea id="posttext_{searchresults.U_POST_ID}" rows="15" cols="35" wrap="virtual" class="post" style="width:100%;" onkeyup="AJAXPostEditkeyUp(event, {searchresults.U_POST_ID})">{searchresults.RAW_MESSAGE}</textarea><textarea id="orig_posttext_{searchresults.U_POST_ID}" rows="1" cols="1" style="display:none;">{searchresults.RAW_MESSAGE}</textarea><br />
			<input type="button" value=" + " onclick="AJAXEnlargePostArea({searchresults.U_POST_ID});return false;" class="liteoption" />&nbsp;<input type="button" value=" - " onclick="AJAXShortenPostArea({searchresults.U_POST_ID});return false;" class="liteoption" />&nbsp;&nbsp;&nbsp;<input type="button" onclick="AJAXEndPostEdit({searchresults.U_POST_ID}, {RETURN_CHARS});return false;" value="{L_SAVE_CHANGES}" class="liteoption" />&nbsp;<input type="button" onclick="AJAXCancelPostEdit({searchresults.U_POST_ID});return false;" value="{L_CANCEL}" class="liteoption" />&nbsp;<a href="{searchresults.U_EDIT_POST}" class="gen">{L_FULL_EDIT}</a>
		</div>
		<!-- END can_edit -->
	</td>


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
 
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
<script type="text/javascript" src="includes/javascript/ajax_topicfunctions.js"></script>


# 
#-----[ FIND ]------------------------------------------------ 
# 
	<td class="row1" align="center" valign="middle"><img src="{searchresults.TOPIC_FOLDER_IMG}" width="19" height="18" alt="{searchresults.L_TOPIC_FOLDER_ALT}" title="{searchresults.L_TOPIC_FOLDER_ALT}" /></td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
valign="middle">


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# 
{searchresults.S_MARK_LINK_START}


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
src="{searchresults.TOPIC_FOLDER_IMG}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 id="topicimage_{searchresults.TOPIC_ID}"


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
title="{searchresults.L_TOPIC_FOLDER_ALT}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 border="0"


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
</td>


# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
# 
{searchresults.S_MARK_LINK_END}</td>


# 
#-----[ FIND ]------------------------------------------------ 
# 
	<td class="row2"><span class="topictitle">{searchresults.NEWEST_POST_IMG}{searchresults.TOPIC_TYPE}<a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a></span><br /><span class="gensmall">{searchresults.GOTO_PAGE}</span></td>


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
	<td class="row2" {searchresults.S_AJAX_EDIT_TITLE}>
		<span class="topictitle"><span id="topicnewest_{searchresults.TOPIC_ID}">{searchresults.NEWEST_POST_IMG}</span>{searchresults.TOPIC_TYPE}<a href="{searchresults.U_VIEW_TOPIC}" id="topiclink_{searchresults.TOPIC_FIRST_POST_ID}" class="topictitle">{searchresults.TOPIC_TITLE}</a>
	  	<!-- BEGIN can_edit_title -->
	  	<span id="title_{searchresults.TOPIC_FIRST_POST_ID}" style="display:none;"><input type="text" class="post" name="topictitle_{searchresults.TOPIC_FIRST_POST_ID}" id="topictitle_{searchresults.TOPIC_FIRST_POST_ID}" value="{searchresults.TOPIC_TITLE}" size="40" maxlength="60" onkeyup="AJAXTitleEditKeyUp(event, {searchresults.TOPIC_FIRST_POST_ID})" /><input type="hidden" id="orig_topictitle_{searchresults.TOPIC_FIRST_POST_ID}" value="{searchresults.TOPIC_TITLE}" />&nbsp;<input type="button" onclick="AJAXEndTitleEdit({searchresults.TOPIC_FIRST_POST_ID})" value="{L_SAVE_CHANGES}" class="mainoption" />&nbsp;<input type="button" onclick="AJAXCancelTitleEdit({searchresults.TOPIC_FIRST_POST_ID})" value="{L_CANCEL}" class="liteoption" /></span>
	  	<!-- END can_edit_title -->
		</span><br /><span class="gensmall">{searchresults.GOTO_PAGE}</span>
	</td>


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
<script language="javascript" type="text/javascript">


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
<script type="text/javascript" src="includes/javascript/ajax_searchfunctions.js"></script>


# 
#-----[ FIND ]------------------------------------------------ 
# 
function refresh_username(selected_username)
{


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	if (selected_username == '-1')
	{
		return;
	}
	


# 
#-----[ FIND ]------------------------------------------------ 
# 
				<td valign="top" class="row1"><span class="genmed"><br /><input type="text" name="search_username" value="{USERNAME}" class="post" />&nbsp; <input type="submit" name="search" value="{L_SEARCH}" class="liteoption" /></span><br /><span class="gensmall">{L_SEARCH_EXPLAIN}</span><br />


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
class="post"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 onkeyup="AJAXUsernameSearch(this.value, 1);"


# 
#-----[ FIND ]------------------------------------------------ 
# 
				<!-- BEGIN switch_select_name -->


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# This means that you should delete the line


# 
#-----[ FIND ]------------------------------------------------ 
# 
				<span class="genmed">{L_UPDATE_USERNAME}<br /><select name="username_list">{S_USERNAME_OPTIONS}</select>&nbsp; <input type="submit" class="liteoption" onClick="refresh_username(this.form.username_list.options[this.form.username_list.selectedIndex].value);return false;" name="use" value="{L_SELECT}" /></span><br />


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
<span class="genmed"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 id="username_list" {USERNAME_LIST_VIS}
 

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
<select name="username_list">


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
<span id="username_select">


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
&nbsp; <input type="submit"


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
</span>


# 
#-----[ FIND ]------------------------------------------------ 
# 
				<!-- END switch_select_name -->


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# This means that you should delete the line


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
</head>


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#

<script type="text/javascript">
<!--
var S_SID = '{S_SID}';
var ajax_core_defined = 0;
var phpbb_root_path = '{PHPBB_ROOT_PATH}';
var phpEx = '{PHPEX}';
var POST_FORUM_URL = '{POST_FORUM_URL}';
var POST_TOPIC_URL = '{POST_TOPIC_URL}';
var POST_POST_URL = '{POST_POST_URL}';
//-->
</script>

<script type="text/javascript" src="includes/javascript/ajax_core.js"></script>


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
<form method="post" action="{S_POST_DAYS_ACTION}">


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# This is not an error, just replace the form tag, we'll add it back in later
<script type="text/javascript" src="includes/javascript/ajax_topicfunctions.js"></script>



# 
#-----[ FIND ]------------------------------------------------ 
# 
	  <td class="row1" align="center" valign="middle" width="20"><img src="{topicrow.TOPIC_FOLDER_IMG}" width="19" height="18" alt="{topicrow.L_TOPIC_FOLDER_ALT}" title="{topicrow.L_TOPIC_FOLDER_ALT}" /></td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
valign="middle" width="20">


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# 
{topicrow.S_MARK_LINK_START}


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
src="{topicrow.TOPIC_FOLDER_IMG}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 id="topicimage_{topicrow.TOPIC_ID}"


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
title="{topicrow.L_TOPIC_FOLDER_ALT}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 border="0"


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
</td>


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
{topicrow.S_MARK_LINK_END}


# 
#-----[ FIND ]------------------------------------------------ 
# 
	  <td class="row1" width="100%"><span class="topictitle">{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a></span><span class="gensmall"><br />


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
	  <td {topicrow.S_AJAX_EDIT_TITLE} class="row1" width="100%">
	  	<span class="topictitle"><span id="topicnewest_{topicrow.TOPIC_ID}">{topicrow.NEWEST_POST_IMG}</span>{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" id="topiclink_{topicrow.TOPIC_FIRST_POST_ID}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
	  	<!-- BEGIN can_edit_title -->
	  	<span id="title_{topicrow.TOPIC_FIRST_POST_ID}" style="display:none;"><input type="text" class="post" name="topictitle_{topicrow.TOPIC_FIRST_POST_ID}" id="topictitle_{topicrow.TOPIC_FIRST_POST_ID}" value="{topicrow.TOPIC_TITLE}" size="40" maxlength="60" onkeyup="AJAXTitleEditKeyUp(event, {topicrow.TOPIC_FIRST_POST_ID})" /><input type="hidden" id="orig_topictitle_{topicrow.TOPIC_FIRST_POST_ID}" value="{topicrow.TOPIC_TITLE}" />&nbsp;<input type="button" onclick="AJAXEndTitleEdit({topicrow.TOPIC_FIRST_POST_ID})" value="{L_SAVE_CHANGES}" class="mainoption" />&nbsp;<input type="button" onclick="AJAXCancelTitleEdit({topicrow.TOPIC_FIRST_POST_ID})" value="{L_CANCEL}" class="liteoption" /></span>
	  	<!-- END can_edit_title -->
	  	</span><span class="gensmall"><br />


# 
#-----[ FIND ]------------------------------------------------ 
# 
	<!-- END switch_no_topics -->


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	<form method="post" action="{S_POST_DAYS_ACTION}">


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
<table width="100%" cellspacing="2" cellpadding="2" border="0">


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
<script type="text/javascript" src="includes/javascript/ajax_topicfunctions.js"></script>
<script type="text/javascript">
<!--
is_viewtopic = 1;
highlight = '{HIGHLIGHT}';
//-->
</script>



# 
#-----[ FIND ]------------------------------------------------ 
# 
	<td align="left" valign="bottom" colspan="2"><a class="maintitle" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a><br />


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
href="{U_VIEW_TOPIC}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 id="topiclink_top"


# 
#-----[ FIND ]------------------------------------------------ 
# 
	<td align="left" valign="bottom" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" align="middle" /></a>&nbsp;&nbsp;&nbsp;<a href="{U_POST_REPLY_TOPIC}"><img src="{REPLY_IMG}" border="0" alt="{L_POST_REPLY_TOPIC}" align="middle" /></a></span></td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
src="{REPLY_IMG}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 id="replyimg_top"


# 
#-----[ FIND ]------------------------------------------------ 
# 
				<td width="100%"><a href="{postrow.U_MINI_POST}"><img src="{postrow.MINI_POST_IMG}" width="12" height="9" alt="{postrow.L_MINI_POST_ALT}" title="{postrow.L_MINI_POST_ALT}" border="0" /></a><span class="postdetails">{L_POSTED}: {postrow.POST_DATE}<span class="gen">&nbsp;</span>&nbsp; &nbsp;{L_POST_SUBJECT}: {postrow.POST_SUBJECT}</span></td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
{L_POST_SUBJECT}: {postrow.POST_SUBJECT}</span></td>


# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
# Note the trailing space!
<span {postrow.S_AJAX_EDIT_TITLE}>{L_POST_SUBJECT}: 


# 
#-----[ FIND ]------------------------------------------------ 
# 
				<td valign="top" nowrap="nowrap">{postrow.QUOTE_IMG} {postrow.EDIT_IMG} {postrow.DELETE_IMG} {postrow.IP_IMG}</td>


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
					<span id="topiclink_{postrow.U_POST_ID}">{postrow.POST_SUBJECT}</span></span>
				  	<!-- BEGIN can_edit -->
				  	<span id="title_{postrow.U_POST_ID}" style="display:none;"><input type="text" class="post" name="topictitle_{postrow.U_POST_ID}" id="topictitle_{postrow.U_POST_ID}" value="{postrow.POST_RAW_SUBJECT}" size="40" maxlength="60" onkeyup="AJAXTitleEditKeyUp(event, {postrow.U_POST_ID})" /><input type="hidden" id="orig_topictitle_{postrow.U_POST_ID}" value="{postrow.POST_RAW_SUBJECT}" />&nbsp;<input type="button" onclick="AJAXEndTitleEdit({postrow.U_POST_ID})" value="{L_SAVE_CHANGES}" class="mainoption" />&nbsp;<input type="button" onclick="AJAXCancelTitleEdit({postrow.U_POST_ID})" value="{L_CANCEL}" class="liteoption" /></span>
				  	<!-- END can_edit -->
					</span></td>


# 
#-----[ FIND ]------------------------------------------------ 
# 
				<td colspan="2"><span class="postbody">{postrow.MESSAGE}{postrow.SIGNATURE}</span><span class="gensmall">{postrow.EDITED_MESSAGE}</span></td>


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
				<td colspan="2">
					<span id="postmessage_{postrow.U_POST_ID}"><span class="postbody">{postrow.MESSAGE}</span></span>
					<!-- BEGIN can_edit -->
					<div class="gen" id="post_{postrow.U_POST_ID}" style="display:none; text-align:right;">
						<textarea id="posttext_{postrow.U_POST_ID}" rows="15" cols="35" wrap="virtual" class="post" style="width:100%;" onkeyup="AJAXPostEditkeyUp(event, {postrow.U_POST_ID})">{postrow.RAW_MESSAGE}</textarea><textarea id="orig_posttext_{postrow.U_POST_ID}" rows="1" cols="1" style="display:none;">{postrow.RAW_MESSAGE}</textarea><br />
						<input type="button" value=" + " onclick="AJAXEnlargePostArea({postrow.U_POST_ID});return false;" class="liteoption" />&nbsp;<input type="button" value=" - " onclick="AJAXShortenPostArea({postrow.U_POST_ID});return false;" class="liteoption" />&nbsp;&nbsp;&nbsp;<input type="button" onclick="AJAXEndPostEdit({postrow.U_POST_ID}, -1);return false;" value="{L_SAVE_CHANGES}" class="liteoption" />&nbsp;<input type="button" onclick="AJAXCancelPostEdit({postrow.U_POST_ID});return false;" value="{L_CANCEL}" class="liteoption" />&nbsp;<a href="{postrow.U_EDIT_POST}" class="gen">{L_FULL_EDIT}</a>
					</div>
					<!-- END can_edit -->
					<span class="postbody">{postrow.SIGNATURE}</span>
					<span id="editmessage_{postrow.U_POST_ID}" class="gensmall">{postrow.EDITED_MESSAGE}</span>
				</td>


# 
#-----[ FIND ]------------------------------------------------ 
# 
	<td align="left" valign="middle" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" align="middle" /></a>&nbsp;&nbsp;&nbsp;<a href="{U_POST_REPLY_TOPIC}"><img src="{REPLY_IMG}" border="0" alt="{L_POST_REPLY_TOPIC}" align="middle" /></a></span></td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
src="{REPLY_IMG}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 id="replyimg_bottom"


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
				<td class="row2" colspan="2"><br clear="all" /><form method="POST" action="{S_POLL_ACTION}"><table cellspacing="0" cellpadding="4" border="0" align="center">


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
class="row2" colspan="2"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 id="pollbox"


# 
#-----[ FIND ]------------------------------------------------ 
# 
								<td><input type="radio" name="vote_id" value="{poll_option.POLL_OPTION_ID}" />&nbsp;</td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
value="{poll_option.POLL_OPTION_ID}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 onclick="AJAXSelPollOption({poll_option.POLL_OPTION_ID})"


# 
#-----[ FIND ]------------------------------------------------ 
# 
			<input type="submit" name="submit" value="{L_SUBMIT_VOTE}" class="liteoption" />


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
name="submit"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 onclick="return AJAXVotePoll({TOPIC_ID});"


# 
#-----[ FIND ]------------------------------------------------ 
# 
		  <td align="center"><span class="gensmall"><b><a href="{U_VIEW_RESULTS}" class="gensmall">{L_VIEW_RESULTS}</a></b></span></td>


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
href="{U_VIEW_RESULTS}"


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 onClick="return AJAXViewPollResult({TOPIC_ID});"


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
	  <tr> 
		<td colspan="4" align="center"><span class="gen"><b>{L_TOTAL_VOTES} : {TOTAL_VOTES}</b></span></td>
	  </tr>


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	  <!-- BEGIN switch_view_ballot -->
		<tr>
			<td align="center"><span class="gensmall"><b><a href="{U_VIEW_BALLOT}" onClick="return AJAXViewPollBallot({TOPIC_ID});" class="gensmall">{L_VIEW_BALLOT}</a></b></span></td>
		</tr>
	  <!-- END switch_view_ballot -->


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


# 
#-----[ FIND ]------------------------------------------------ 
# 
$tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t"]) : array();
$tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f"]) : array();



# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
// Marking a single forum as read - ajax_features by alcaeus
if ($mark_read == 'forum')
{
	// Get forum_id
	if (isset($HTTP_POST_VARS[POST_FORUM_URL]) || isset($HTTP_GET_VARS[POST_FORUM_URL]))
	{
		$forum_id = (isset($HTTP_POST_VARS[POST_FORUM_URL])) ? intval($HTTP_POST_VARS[POST_FORUM_URL]) : intval($HTTP_GET_VARS[POST_FORUM_URL]);
	}
	else
	{
		$forum_id = 0;
	}
	
	if ($userdata['session_logged_in'] && !empty($forum_id))
	{
		if ((count($tracking_forums) + count($tracking_topics)) >= 150 && empty($tracking_forums[$forum_id]))
		{
			asort($tracking_forums);
			unset($tracking_forums[key($tracking_forums)]);
		}
		
		$tracking_forums[$forum_id] = time();
		
		setcookie($board_config['cookie_name'] .'_f', serialize($tracking_forums), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
	}
}



# 
#-----[ FIND ]------------------------------------------------ 
# 
							$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
							$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
							
							$mark_link = "index.$phpEx?mark=forum&amp;". POST_FORUM_URL .'='. $forum_data[$j]['forum_id'];
							$mark_link .= ($viewcat != -1) ? '&amp;'. POST_CAT_URL .'='. $viewcat : '';
							$mark_link_start = ($userdata['session_logged_in']) ? '<a onclick="return AJAXMarkForum('. $forum_data[$j]['forum_id'] .');" href="'. $mark_link .'">' : '';
							$mark_link_end = ($userdata['session_logged_in']) ? '</a>' : '';


# 
#-----[ FIND ]------------------------------------------------ 
# 
								'MODERATORS' => $moderator_list,


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
								'FORUM_ID' => $forum_data[$j]['forum_id'],


# 
#-----[ FIND ]------------------------------------------------ 
# 
								'U_VIEWFORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"))


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
								'S_MARK_LINK_START' => $mark_link_start,
								'S_MARK_LINK_END' => $mark_link_end,
								


# 
#-----[ OPEN ]------------------------------------------------ 
# 
modcp.php


# 
#-----[ FIND ]------------------------------------------------ 
# 
			'L_REPLIES' => $lang['Replies'], 
			'L_LASTPOST' => $lang['Last_Post'], 
			'L_SELECT' => $lang['Select'], 


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
			'L_SAVE_CHANGES' => $lang['Save_changes'],
			'L_CANCEL' => $lang['Cancel'],


# 
#-----[ FIND ]------------------------------------------------ 
# 
				'TOPIC_ID' => $topic_id,


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
				'TOPIC_FIRST_POST_ID' => $row['topic_first_post_id'],
				'FORUM_ID' => $forum_id,


# 
#-----[ OPEN ]------------------------------------------------ 
# 
posting.php


# 
#-----[ FIND ]------------------------------------------------ 
# 
	'U_REVIEW_TOPIC' => ( $mode == 'reply' ) ? append_sid("posting.$phpEx?mode=topicreview&amp;" . POST_TOPIC_URL . "=$topic_id") : '', 


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	
	'S_AJAX_BLUR' => ($mode == 'newtopic') ? 'onblur="AJAXSearch(this.value);"' : '',
	'S_IS_PM' => 0,
	'S_DISPLAY_PREVIEW' => ($preview) ? '' : 'style="display:none;"',
	'S_EDIT_POST_ID' => ($mode == 'editpost') ? $post_id : 0,
	'L_SEARCH_RESULTS' => $lang['AJAX_search_results'],
	'L_SEARCH_RESULT' => $lang['AJAX_search_result'],
	'L_EMPTY_SUBJECT' => $lang['Empty_subject'],


# 
#-----[ OPEN ]------------------------------------------------ 
# 
privmsg.php


# 
#-----[ FIND ]------------------------------------------------ 
# 
		'L_STYLES_TIP' => $lang['Styles_tip'], 


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
		
		'S_AJAX_BLUR' => 'onblur="SubjectCheck(this.value);"',
		'S_IS_PM' => 1,
		'S_DISPLAY_PREVIEW' => ($preview) ? '' : 'style="display:none;"',
		'S_EDIT_POST_ID' => ($mode == 'edit') ? $privmsg_id : 0,
		'L_EMPTY_SUBJECT' => $lang['Empty_subject'],
		'L_MORE_MATCHES' => $lang['More_matches_username'],


# 
#-----[ OPEN ]------------------------------------------------ 
# 
search.php


# 
#-----[ FIND ]------------------------------------------------ 
# 
$show_results = ( isset($HTTP_POST_VARS['show_results']) ) ? $HTTP_POST_VARS['show_results'] : 'posts';
$show_results = ($show_results == 'topics') ? 'topics' : 'posts';


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
if (isset($HTTP_POST_VARS['show_results']) || isset($HTTP_GET_VARS['show_results']))
{
	$show_results = (isset($HTTP_POST_VARS['show_results'])) ? $HTTP_POST_VARS['show_results'] : $HTTP_GET_VARS['show_results'];
}
else
{
	$show_results = 'posts';
}
$show_results = ($show_results == 'topics') ? 'topics' : 'posts';

if (isset($HTTP_POST_VARS['is_ajax']) || isset($HTTP_GET_VARS['is_ajax']))
{
	$is_ajax = (isset($HTTP_POST_VARS['is_ajax'])) ? intval($HTTP_POST_VARS['is_ajax']) : intval($HTTP_GET_VARS['is_ajax']);
}
else
{
	$is_ajax = 0;
}


# 
#-----[ FIND ]------------------------------------------------ 
# 
if ( isset($HTTP_POST_VARS['search_terms']) )
{
	$search_terms = ( $HTTP_POST_VARS['search_terms'] == 'all' ) ? 1 : 0;
}
else
{
	$search_terms = 0;
}


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
if (isset($HTTP_POST_VARS['search_terms']) || isset($HTTP_GET_VARS['search_terms']))
{
	$search_terms = (isset($HTTP_POST_VARS['search_terms'])) ? $HTTP_POST_VARS['search_terms'] : $HTTP_GET_VARS['search_terms'];
}
else
{
	$search_terms = 'any';
}
$search_terms = ($search_terms == 'all') ? 1 : 0;


# 
#-----[ FIND ]------------------------------------------------ 
# 
if ( isset($HTTP_POST_VARS['search_fields']) )
{
	$search_fields = ( $HTTP_POST_VARS['search_fields'] == 'all' ) ? 1 : 0;
}
else
{
	$search_fields = 0;
}


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
if (isset($HTTP_POST_VARS['search_fields']) || isset($HTTP_GET_VARS['search_fields']))
{
	$search_fields = (isset($HTTP_POST_VARS['search_fields'])) ? $HTTP_POST_VARS['search_fields'] : $HTTP_GET_VARS['search_fields'];
}
else
{
	$search_fields = 'all';
}
$search_fields = ($search_fields == 'all') ? 1 : 0;


# 
#-----[ FIND ]------------------------------------------------ 
# 
$return_chars = ( isset($HTTP_POST_VARS['return_chars']) ) ? intval($HTTP_POST_VARS['return_chars']) : 200;


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
if (isset($HTTP_POST_VARS['return_chars']) || isset($HTTP_GET_VARS['return_chars']))
{
	$return_chars = (isset($HTTP_POST_VARS['return_chars'])) ? intval($HTTP_POST_VARS['return_chars']) : intval($HTTP_GET_VARS['return_chars']);
}
else
{
	$return_chars = 200;
}


# 
#-----[ FIND ]------------------------------------------------ 
# 
$search_cat = ( isset($HTTP_POST_VARS['search_cat']) ) ? intval($HTTP_POST_VARS['search_cat']) : -1;
$search_forum = ( isset($HTTP_POST_VARS['search_forum']) ) ? intval($HTTP_POST_VARS['search_forum']) : -1;


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
if (isset($HTTP_POST_VARS['search_cat']) || isset($HTTP_GET_VARS['search_cat']))
{
	$search_cat = (isset($HTTP_POST_VARS['search_cat'])) ? intval($HTTP_POST_VARS['search_cat']) : intval($HTTP_GET_VARS['search_cat']);
}
else
{
	$search_cat = -1;
}

if (isset($HTTP_POST_VARS['search_forum']) || isset($HTTP_GET_VARS['search_forum']))
{
	$search_forum = (isset($HTTP_POST_VARS['search_forum'])) ? intval($HTTP_POST_VARS['search_forum']) : intval($HTTP_GET_VARS['search_forum']);
}
else
{
	$search_forum = -1;
}


# 
#-----[ FIND ]------------------------------------------------ 
# 
$sort_by = ( isset($HTTP_POST_VARS['sort_by']) ) ? intval($HTTP_POST_VARS['sort_by']) : 0;


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
if (isset($HTTP_POST_VARS['sort_by']) || isset($HTTP_GET_VARS['sort_by']))
{
	$sort_by = (isset($HTTP_POST_VARS['sort_by'])) ? intval($HTTP_POST_VARS['sort_by']) : intval($HTTP_GET_VARS['sort_by']);
}
else
{
	$sort_by = 0;
}


# 
#-----[ FIND ]------------------------------------------------ 
# 
if ( isset($HTTP_POST_VARS['sort_dir']) )
{
	$sort_dir = ( $HTTP_POST_VARS['sort_dir'] == 'DESC' ) ? 'DESC' : 'ASC';
}
else
{
	$sort_dir =  'DESC';
}


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
if (isset($HTTP_POST_VARS['sort_dir']) || isset($HTTP_GET_VARS['sort_dir']))
{
	$sort_dir = (isset($HTTP_POST_VARS['sort_dir'])) ? $HTTP_POST_VARS['sort_dir'] : $HTTP_GET_VARS['sort_dir'];
}
else
{
	$sort_dir =  'DESC';
}
$sort_dir = ($sort_dir == 'ASC') ? 'ASC' : 'DESC';


# 
#-----[ FIND ]------------------------------------------------ 
# 
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
if (isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['start']))
{
	$start = (isset($HTTP_POST_VARS['start'])) ? intval($HTTP_POST_VARS['start']) : intval($HTTP_GET_VARS['start']);
}
else
{
	$start = 0;
}


# 
#-----[ FIND ]------------------------------------------------ 
# 
	if ( isset($HTTP_POST_VARS['search_username']) )


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
isset($HTTP_POST_VARS['search_username'])

# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 || isset($HTTP_GET_VARS['search_username'])


# 
#-----[ FIND ]------------------------------------------------ 
# 
		username_search($HTTP_POST_VARS['search_username']);


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
		username_search((!empty($HTTP_POST_VARS['search_username'])) ? $HTTP_POST_VARS['search_username'] : $HTTP_GET_VARS['search_username']);


# 
#-----[ FIND ]------------------------------------------------ 
# 
					message_die(GENERAL_MESSAGE, $lang['Search_Flood_Error']);


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
					if ($is_ajax)
					{
						$result_ar = array(
							'search_id' => 0,
							'results' => 0,
							'keywords' => ''
						);
						AJAX_message_die($result_ar);
					}
					else
					{
						message_die(GENERAL_MESSAGE, $lang['Search_Flood_Error']);
					}


# 
#-----[ FIND ]------------------------------------------------ 
# 
			$is_auth = auth(AUTH_READ, $search_forum, $userdata);


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
			$is_auth = auth(AUTH_ALL, $search_forum, $userdata);


# 
#-----[ FIND ]------------------------------------------------ 
# 
			$is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata); 


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
			$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata);


# 
#-----[ FIND ]------------------------------------------------ 
# 
			$show_results = 'topics';
			$sort_by = 0;
			$sort_dir = 'DESC';
		}


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
		else if ($is_ajax)
		{
			$result_ar = array(
				'search_id' => 0,
				'results' => 0,
				'keywords' => ''
			);
			AJAX_message_die($result_ar);
		}


# 
#-----[ FIND ]------------------------------------------------ 
# 
		//
		// Output header
		//


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
		if ($is_ajax)
		{
			$result_ar = array(
				'search_id' => ($total_match_count == 1) ? $searchset[0]['topic_id'] : $search_id,
				'results' => $total_match_count,
				'keywords' => $search_keywords
			);
			AJAX_message_die($result_ar);
		}
		


# 
#-----[ FIND ]------------------------------------------------ 
# 
		for($i = 0; $i < count($searchset); $i++)


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
		if ($show_results == 'posts')
		{
			if ($search_forum == -1)
			{
				$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata);
			}
			else
			{
				$is_auth = auth(AUTH_ALL, $search_forums, $userdata);
			}
		}
		


# 
#-----[ FIND ]------------------------------------------------ 
# 
			if ( $show_results == 'posts' )
			{


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
				if ($search_forum == -1)
				{
					$is_auth = $is_auth_ary[$forum_id];
				}
				


# 
#-----[ FIND ]------------------------------------------------ 
# 
						$post_subject = ( $searchset[$i]['post_subject'] != "" ) ? preg_replace($orig_word, $replacement_word, $searchset[$i]['post_subject']) : $topic_title;


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
						$post_subject = ( $searchset[$i]['post_subject'] != "" ) ? preg_replace($orig_word, $replacement_word, $searchset[$i]['post_subject']) : '';


# 
#-----[ FIND ]------------------------------------------------ 
# 
						$post_subject = ( $searchset[$i]['post_subject'] != '' ) ? $searchset[$i]['post_subject'] : $topic_title;


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
						$post_subject = $searchset[$i]['post_subject'];


# 
#-----[ FIND ]------------------------------------------------ 
# 
				$poster = ( $searchset[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $searchset[$i]['user_id']) . '">' : '';
				$poster .= ( $searchset[$i]['user_id'] != ANONYMOUS ) ? $searchset[$i]['username'] : ( ( $searchset[$i]['post_username'] != "" ) ? $searchset[$i]['post_username'] : $lang['Guest'] );
				$poster .= ( $searchset[$i]['user_id'] != ANONYMOUS ) ? '</a>' : '';


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
				$is_firstpost = ($searchset[$i]['post_id'] == $searchset[$i]['topic_first_post_id']) ? 1 : 0;
				$edit_url = '';
				$edit_img = '';
				if ($can_edit = ($is_auth['auth_mod'] || (($searchset[$i]['user_id'] == $userdata['user_id'] && ($searchset[$i]['topic_status'] != TOPIC_LOCKED)) && $is_auth['auth_edit'])))
				{
					$raw_message = $searchset[$i]['post_text'];
					if (!empty($bbcode_uid))
					{
						$raw_message = preg_replace('#\:(([a-z0-9]:)?)'. $bbcode_uid .'#s', '', $raw_message);
					}
				
					$raw_message = str_replace('<', '&lt;', $raw_message);
					$raw_message = str_replace('>', '&gt;', $raw_message);
					$raw_message = str_replace('<br />', "\n", $raw_message);
					
					$edit_url = append_sid("posting.$phpEx?mode=editpost&amp;". POST_POST_URL ."=". $searchset[$i]['post_id']);
					$edit_img = '<a id="editimg_'. $searchset[$i]['post_id'] .'" onclick="return AJAXPostEdit('. $searchset[$i]['post_id'] .');" href="'. $edit_url .'"><img src="'. $images['icon_edit'] .'" alt="'. $lang['Edit_delete_post'] .'" title="'. $lang['Edit_delete_post'] .'" border="0" align="right" /></a><br />';
				}
				


# 
#-----[ FIND ]------------------------------------------------ 
# 
					'POST_SUBJECT' => $post_subject,


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
					'POST_SUBJECT' => (empty($post_subject)) ? $lang['No_subject'] : $post_subject,
					'POST_RAW_SUBJECT' => $post_subject,


# 
#-----[ FIND ]------------------------------------------------ 
# 
					'U_POST' => $post_url,


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
					'RAW_MESSAGE' => $raw_message,
					'U_POST_ID' => $searchset[$i]['post_id'],
					'U_EDIT_POST' => $edit_url,
					'U_EDIT_IMG' => $edit_img,
					'S_AJAX_EDIT_TITLE' => ($can_edit) ? 'ondblclick="AJAXTitleEdit('. $searchset[$i]['post_id'] .', '. $is_firstpost .');"' : '',


# 
#-----[ FIND ]------------------------------------------------ 
# 
					'U_TOPIC' => $topic_url,
					'U_FORUM' => $forum_url)
				);


# 
#-----[ AFTER, ADD ]------------------------------------------ 
# Make sure to add the line after the closing parenthesis!
				if ($can_edit)
				{
					$template->assign_block_vars('searchresults.can_edit', array());
				}
				$template->assign_var('RETURN_CHARS', $return_chars);


# 
#-----[ FIND ]------------------------------------------------ 
# 
				$template->assign_block_vars('searchresults', array( 
					'FORUM_NAME' => $searchset[$i]['forum_name'],


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
				$mark_link_start = ($userdata['session_logged_in']) ? '<a onclick="return AJAXMarkTopic('. $topic_id .');" href="#">' : '';
				$mark_link_end = ($userdata['session_logged_in']) ? '</a>' : '';
				$this_auth = ($search_forums == -1) ? $is_auth : $is_auth_ary[$forum_id];
				$can_edit = ($this_auth['auth_mod'] || ((($searchset[$i]['topic_poster'] == $userdata['user_id']) && ($searchset[$i]['topic_status'] != TOPIC_LOCKED)) && $this_auth['auth_edit']));
				


# 
#-----[ FIND ]------------------------------------------------ 
# 
					'FORUM_ID' => $forum_id,
					'TOPIC_ID' => $topic_id,


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
					'TOPIC_FIRST_POST_ID' => $searchset[$i]['topic_first_post_id'],


# 
#-----[ FIND ]------------------------------------------------ 
# 
					'L_TOPIC_FOLDER_ALT' => $folder_alt, 



# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
					'S_MARK_LINK_START' => $mark_link_start,
					'S_MARK_LINK_END' => $mark_link_end,
					'S_AJAX_EDIT_TITLE' => ($can_edit) ? ' ondblclick="AJAXTitleEdit('. $searchset[$i]['topic_first_post_id'] .', 0)"' : '',
					


# 
#-----[ FIND ]------------------------------------------------ 
# 
					'U_VIEW_FORUM' => $forum_url, 
					'U_VIEW_TOPIC' => $topic_url)
				);


# 
#-----[ AFTER, ADD ]------------------------------------------ 
# Make sure to add these lines after the closing parenthesis!
				
				if ($can_edit)
				{
					$template->assign_block_vars('searchresults.can_edit_title', array());
				}


# 
#-----[ FIND ]------------------------------------------------ 
# 
			'L_POSTED' => $lang['Posted'], 
			'L_SUBJECT' => $lang['Subject'],


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
			'L_FULL_EDIT' => $lang['Full_edit'],
			'L_SAVE_CHANGES' => $lang['Save_changes'],
			'L_CANCEL' => $lang['Cancel'],


# 
#-----[ FIND ]------------------------------------------------ 
# 
		$template->pparse('body');

		include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
	}


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	else if ($is_ajax)
	{
		$result_ar = array(
			'search_id' => 0,
			'results' => 0,
			'keywords' => ''
		);
		AJAX_message_die($result_ar);
	}


# 
#-----[ FIND ]------------------------------------------------ 
# 
$is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata);


# 
#-----[ OPEN ]------------------------------------------------ 
# 
viewforum.php


# 
#-----[ FIND ]------------------------------------------------ 
# 
$tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : '';
$tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : '';



# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
// Marking a single topic as read - ajax_features by alcaeus
if ($mark_read == 'topic')
{
	// Get topic_id
	if (isset($HTTP_POST_VARS[POST_TOPIC_URL]) || isset($HTTP_GET_VARS[POST_TOPIC_URL]))
	{
		$topic_id = (isset($HTTP_POST_VARS[POST_TOPIC_URL])) ? intval($HTTP_POST_VARS[POST_TOPIC_URL]) : intval($HTTP_GET_VARS[POST_TOPIC_URL]);
	}
	else
	{
		$topic_id = 0;
	}
	
	if ($userdata['session_logged_in'] && !empty($topic_id))
	{
		if (count($tracking_topics) >= 150 && empty($tracking_topics[$topic_id]))
		{
			asort($tracking_topics);
			unset($tracking_topics[key($tracking_topics)]);
		}
	
		$tracking_topics[$topic_id] = time();
	
		setcookie($board_config['cookie_name'] .'_t', serialize($tracking_topics), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
	}
}



# 
#-----[ FIND ]------------------------------------------------ 
# 
	'L_JOINED' => $lang['Joined'],
	'L_AUTHOR' => $lang['Author'],


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	'L_SAVE_CHANGES' => $lang['Save_changes'],
	'L_CANCEL' => $lang['Cancel'],


# 
#-----[ FIND ]------------------------------------------------ 
# 
		$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
		$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
		
		$mark_link = append_sid("viewforum.$phpEx?mark=topic&amp;". POST_FORUM_URL ."={$forum_id}&amp;". POST_TOPIC_URL ."=$topic_id&amp;topicdays={$topic_days}&amp;start={$start}");
		$mark_link_start = ($userdata['session_logged_in']) ? '<a onclick="return AJAXMarkTopic('. $topic_id .');" href="'. $mark_link .'">' : '';
		$mark_link_end = ($userdata['session_logged_in']) ? '</a>' : '';
		$can_edit = ($is_auth['auth_mod'] || (($topic_rowset[$i]['user_id'] == $userdata['user_id']) && ($topic_rowset[$i]['topic_status'] != TOPIC_LOCKED) && $is_auth['auth_edit']));


# 
#-----[ FIND ]------------------------------------------------ 
# 
			'TOPIC_ID' => $topic_id,


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
			'TOPIC_FIRST_POST_ID' => $topic_rowset[$i]['topic_first_post_id'],


# 
#-----[ FIND ]------------------------------------------------ 
# 
			'U_VIEW_TOPIC' => $view_topic_url)


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
			'S_MARK_LINK_START' => $mark_link_start,
			'S_MARK_LINK_END' => $mark_link_end,
			'S_AJAX_EDIT_TITLE' => ($can_edit) ? 'ondblclick="AJAXTitleEdit('. $topic_rowset[$i]['topic_first_post_id'] .', 0)"' : '',
			


# 
#-----[ FIND ]------------------------------------------------ 
# 
	}

	$topics_count -= $total_announcements;


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
# Make sure to add these lines before the closing curly bracket
		
		if ($can_edit)
		{
			$template->assign_block_vars('topicrow.can_edit_title', array());
		}


# 
#-----[ OPEN ]------------------------------------------------ 
# 
viewtopic.php


# 
#-----[ FIND ]------------------------------------------------ 
# 
$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
t.topic_vote,


# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# Note the leading space!
 t.topic_first_post_id,


# 
#-----[ FIND ]------------------------------------------------ 
# 
	$topic_mod .= ( $forum_topic_data['topic_status'] == TOPIC_UNLOCKED ) ? "<a href=\"modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;mode=lock&amp;sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_mod_lock'] . '" alt="' . $lang['Lock_topic'] . '" title="' . $lang['Lock_topic'] . '" border="0" /></a>&nbsp;' : "<a href=\"modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;mode=unlock&amp;sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_mod_unlock'] . '" alt="' . $lang['Unlock_topic'] . '" title="' . $lang['Unlock_topic'] . '" border="0" /></a>&nbsp;';


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
href=\"modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;mode=lock&amp;sid="


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# Note the trailing space!
id=\"topic_locklink\" onclick=\"return AJAXLockTopic($topic_id, 1);\" 


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
src="' . $images['topic_mod_lock']


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# Note the trailing space!
id="topic_lockimg" 


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
href=\"modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;mode=unlock&amp;sid="


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# Note the trailing space!
id=\"topic_locklink\" onclick=\"return AJAXLockTopic($topic_id, 0);\" 


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
src="' . $images['topic_mod_unlock']


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# Note the trailing space!
id="topic_lockimg" 


# 
#-----[ FIND ]------------------------------------------------ 
# 
		$s_watching_topic = "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;unwatch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '">' . $lang['Stop_watching_topic'] . '</a>';


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;unwatch=topic&amp;start=$start&amp;sid="


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# Note the trailing space!
id=\"watchlink\" onclick=\"return AJAXWatchTopic($topic_id, $start, 0);\" 


# 
#-----[ FIND ]------------------------------------------------ 
# 
		$s_watching_topic_img = ( isset($images['topic_un_watch']) ) ? "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;unwatch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_un_watch'] . '" alt="' . $lang['Stop_watching_topic'] . '" title="' . $lang['Stop_watching_topic'] . '" border="0"></a>' : '';


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;unwatch=topic&amp;start=$start&amp;sid="


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# Note the trailing space!
id=\"watchlink_img\" onclick=\"return AJAXWatchTopic($topic_id, $start, 0);\" 


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
src="' . $images['topic_un_watch']


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
id="watchimage" 


# 
#-----[ FIND ]------------------------------------------------ 
# 
		$s_watching_topic = "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;watch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '">' . $lang['Start_watching_topic'] . '</a>';


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;watch=topic&amp;start=$start&amp;sid="


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# Note the trailing space!
id=\"watchlink\" onclick=\"return AJAXWatchTopic($topic_id, $start, 1);\" 


# 
#-----[ FIND ]------------------------------------------------ 
# 
		$s_watching_topic_img = ( isset($images['Topic_watch']) ) ? "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;watch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '"><img src="' . $images['Topic_watch'] . '" alt="' . $lang['Start_watching_topic'] . '" title="' . $lang['Start_watching_topic'] . '" border="0"></a>' : '';


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;watch=topic&amp;start=$start&amp;sid="


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# Note the trailing space!
id=\"watchlink_img\" onclick=\"return AJAXWatchTopic($topic_id, $start, 1);\" 


# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
src="' . $images['Topic_watch']


# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
id="watchimage" 


# 
#-----[ FIND ]------------------------------------------------ 
# 
	'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / intval($board_config['posts_per_page']) ) + 1 ), ceil( $total_replies / intval($board_config['posts_per_page']) )),


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	'HIGHLIGHT' => $highlight,


# 
#-----[ FIND ]------------------------------------------------ 
# 
	'L_DELETE_TOPIC' => $lang['Delete_topic'],
	'L_GOTO_PAGE' => $lang['Goto_page'],


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	'L_FULL_EDIT' => $lang['Full_edit'],
	'L_SAVE_CHANGES' => $lang['Save_changes'],
	'L_CANCEL' => $lang['Cancel'],


# 
#-----[ FIND ]------------------------------------------------ 
# 
				'TOTAL_VOTES' => $vote_results_sum)
			);


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
				'TOTAL_VOTES' => $vote_results_sum,
				
				'L_VIEW_BALLOT' => $lang['View_ballot'],
				'U_VIEW_BALLOT' => append_sid("viewtopic.$phpEx?". POST_TOPIC_URL ."=$topic_id&amp;postdays=$post_days&amp;postorder=$post_order"))
			);
			
			if (!$user_voted && !$poll_expired && $is_auth['auth_vote'] && ($forum_topic_data['topic_status'] != TOPIC_LOCKED))
			{
				$template->assign_block_vars('switch_view_ballot', array());
			}


# 
#-----[ FIND ]------------------------------------------------ 
# 
	if ( ( $userdata['user_id'] == $poster_id && $is_auth['auth_edit'] ) || $is_auth['auth_mod'] )
	{
		$temp_url = append_sid("posting.$phpEx?mode=editpost&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id']);
		$edit_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_edit'] . '" alt="' . $lang['Edit_delete_post'] . '" title="' . $lang['Edit_delete_post'] . '" border="0" /></a>';
		$edit = '<a href="' . $temp_url . '">' . $lang['Edit_delete_post'] . '</a>';


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
	if ( ( $userdata['user_id'] == $poster_id && $is_auth['auth_edit'] && ($forum_topic_data['topic_status'] != TOPIC_LOCKED)) || $is_auth['auth_mod'] )
	{
		$edit_url = append_sid("posting.$phpEx?mode=editpost&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id']);
		$edit_img = '<a id="editimg_'. $postrow[$i]['post_id'] .'" onclick="return AJAXPostEdit('. $postrow[$i]['post_id'] .');" href="'. $edit_url .'"><img src="' . $images['icon_edit'] . '" alt="' . $lang['Edit_delete_post'] . '" title="' . $lang['Edit_delete_post'] . '" border="0" /></a>';
		$edit = '<a id="editlink_'. $postrow[$i]['post_id'] .'" href="' . $edit_url . '">' . $lang['Edit_delete_post'] . '</a>';


# 
#-----[ FIND ]------------------------------------------------ 
# 
		$edit_img = '';
		$edit = '';


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
		$edit_url = '';


# 
#-----[ FIND ]------------------------------------------------ 
# 
	$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
	$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];



# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	$is_firstpost = ($postrow[$i]['post_id'] == $forum_topic_data['topic_first_post_id']) ? 1 : 0;
	if ($can_edit = ($is_auth['auth_mod'] || (($postrow[$i]['user_id'] == $userdata['user_id'] && ($forum_topic_data['topic_status'] != TOPIC_LOCKED)) && $is_auth['auth_edit'])))
	{
		$raw_message = $postrow[$i]['post_text'];
		if (!empty($bbcode_uid))
		{
			$raw_message = preg_replace('#\:(([a-z0-9]:)?)'. $bbcode_uid .'#s', '', $raw_message);
		}
	
		$raw_message = str_replace('<', '&lt;', $raw_message);
		$raw_message = str_replace('>', '&gt;', $raw_message);
		$raw_message = str_replace('<br />', "\n", $raw_message);
	}
	


# 
#-----[ FIND ]------------------------------------------------ 
# 
		'POST_SUBJECT' => $post_subject,


# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
		'POST_SUBJECT' => (empty($post_subject)) ? $lang['No_subject'] : $post_subject,
		'POST_RAW_SUBJECT' => $post_subject,


# 
#-----[ FIND ]------------------------------------------------ 
# 
		'IP' => $ip,
		'DELETE_IMG' => $delpost_img,
		'DELETE' => $delpost,


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
		'RAW_MESSAGE' => ($can_edit) ? $raw_message : '',


# 
#-----[ FIND ]------------------------------------------------ 
# 
		'U_MINI_POST' => $mini_post_url,


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#
		'S_FIRST_POST' => $is_firstpost,
		'S_AJAX_EDIT_TITLE' => ($can_edit) ? 'ondblclick="AJAXTitleEdit('. $postrow[$i]['post_id'] .', '. $is_firstpost .');"' : '',
		
		'U_EDIT_POST' => $edit_url,


# 
#-----[ FIND ]------------------------------------------------ 
# 
}

$template->pparse('body');


# 
#-----[ BEFORE, ADD ]----------------------------------------- 
# Make sure to add these lines before the closing curly bracket!
	
	if ($can_edit)
	{
		$template->assign_block_vars('postrow.can_edit', array());
	}


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