MyBB Community Forums

Full Version: [ask] how can show who's click thanks
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello,
iam used thanks 2.0 plugin and its work but i dont see who is give thanks person or username, only show
Thank 2
1 was given thank in 1 posts

i want :
 thanks by : username1,username2, or member1, member2
Can you give any modification or solution about this problem ?

thanks for all
up..up..up.. :lol:
Please do not bump your threads unless 24 hours of inactivity have passed.
iam sorry Mr DrPoodle
The ThankYou plugin made by Zaher does that ?
nop
by Arash_j13

its different ? or maybe have any the thankyou plugin other?
Well, if you use the one made by Zaher ... it will show the usernames ...

Mod ::
http://mods.mybboard.net/view/thank-you-2.0

Screenshot ::
http://i4.tinypic.com/47mattl.jpg
thanks Mr LeX-

i'll remove old used and change with new plugin by Zaher
its not work Sad

this thx.php file from Arash_j13
<?php

/**
 * Thank you Thank you 3.0.2
 *
 * Thank you 3.0.1b
 *  Arash_j13
 *  
 Email: 	[email protected]
 WebSite:  WWW.CodeCorona.com
*   	
 *  April 13, 2007
 */ 

if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}


$plugins->add_hook("postbit", "thx");
$plugins->add_hook("xmlhttp", "do_action");
$plugins->add_hook("showthread_start","direct_action");

function thx_info() 
{
	return array(
		'name'			=> '<font color=blue>Thank you</font>',
		'description'	=> 'Add a thank you note to a certain post.<br />',
		'website'		=> '',
		'author'		=> 'Arash_j13',
		'authorsite'	=> 'mailto:[email protected]',
		'version'		=> '3.0.1b',
	);
}

function thx_activate()
{
	global $db;

	$db->query("CREATE TABLE IF NOT EXISTS ".TABLE_PREFIX."thx (
		txid INT UNSIGNED NOT NULL AUTO_INCREMENT ,
		uid int( 10 ) NOT NULL ,
		adduid int( 10 ) NOT NULL ,
		pid int( 10 ) NOT NULL ,
		time bigint(30) NOT NULL,
		PRIMARY KEY ( txid ) 
		) TYPE = MYISAM ;"
	);
	
	if(!$db->field_exists("thx",TABLE_PREFIX."users"))
		$db->query("ALTER TABLE ".TABLE_PREFIX."users ADD `thx` INT NOT NULL ,
			ADD `thxcount` INT NOT NULL ");
			
	if(!$db->field_exists("thx",TABLE_PREFIX."posts"))
		$db->query("ALTER TABLE ".TABLE_PREFIX."posts ADD `thx` INT(1) NOT NULL DEFAULT '0'");

	
	
	$db->query("UPDATE ".TABLE_PREFIX."users u SET 
			u.thx=(SELECT COUNT(*) FROM ".TABLE_PREFIX."thx t WHERE t.adduid=u.uid) ,
			u.thxcount=(SELECT COUNT(*) FROM ".TABLE_PREFIX."thx t WHERE t.uid=u.uid)"); 
	
	$db->query("UPDATE ".TABLE_PREFIX."posts p SET
			p.thx=(SELECT COUNT(*) FROM ".TABLE_PREFIX."thx t WHERE t.pid=p.pid)");
	
	require '../inc/adminfunctions_templates.php';
	
	find_replace_templatesets("postbit", '#'.preg_quote('{$seperator}').'#', '{$post[\'thxdsp\']}{$seperator}');
	find_replace_templatesets("postbit", '#'.preg_quote('{$post[\'button_quote\']}').'#', '{$post[\'button_quote\']}{$post[\'thanks\']}');
	find_replace_templatesets("postbit_thxcount",'##','<span class=\"smalltext\">{$lang->thx_thank} {$post[\'thank_count\']}<br />
													{$post[\'thanked_count\']}<br /></span>');

	find_replace_templatesets("headerinclude","#".preg_quote('{$newpmmsg}').'#',
							'<script type="text/javascript" src="jscripts/thx.js"></script>
							{$newpmmsg}');
							
	//installing settings
	$thx_group = array(
		"gid"			=> "NULL",
		"name"			=> "Thank you",
		"title"			=> "Thank you",
		"description"	=> "Displays thank you note below each post.",
		"disporder"		=> "3",
		"isdefault"		=> "no",
	);
	
	$db->insert_query(TABLE_PREFIX."settinggroups", $thx_group);
	$gid = $db->insert_id();
	
	
	$thx_setting_1 = array(
		"sid"			=> "NULL",
		"name"			=> "thx_active",
		"title"			=> "activate/deactivate this pluguin",
		"description"	=> "activate or deactivate plugin but no delete table",
		"optionscode"	=> "onoff",
		"value"			=> 'on',
		"disporder"		=> '1',
		"gid"			=> intval($gid),
	);
	
	$thx_setting_2 = array(
		"sid"			=> "NULL",
		"name"			=> "thx_count",
		"title"			=> "show count thanks",
		"description"	=> "show count thanks in any post",
		"optionscode"	=> "onoff",
		"value"			=> 'on',
		"disporder"		=> '2',
		"gid"			=> intval($gid),
	);
	
	
	
	$db->insert_query(TABLE_PREFIX."settings", $thx_setting_1);
	$db->insert_query(TABLE_PREFIX."settings", $thx_setting_2);
	rebuild_settings();

}

function thx_deactivate()
{
	global $db;
	require '../inc/adminfunctions_templates.php';

	//$db->query("drop TABLE ".TABLE_PREFIX."thx");
	
	find_replace_templatesets("postbit", '#'.preg_quote('{$post[\'thxdsp\']}').'#', '', 0);
	find_replace_templatesets("postbit", '#'.preg_quote('{$post[\'thanks\']}').'#', '', 0);
	find_replace_templatesets("postbit", '#'.preg_quote('{$post[\'thxcount\']}').'#', '', 0);
	find_replace_templatesets("headerinclude","#".
					preg_quote('<script type="text/javascript" src="jscripts/thx.js"></script>').'#','',0);


	$db->delete_query(TABLE_PREFIX."settings","name='thx_count'");
	$db->delete_query(TABLE_PREFIX."settings","name='thx_active'");
	$db->delete_query(TABLE_PREFIX."settinggroups","name='Thank you'");
	$db->delete_query(TABLE_PREFIX."templates","title='postbit_thxcount'");
	if($db->field_exists("thx",TABLE_PREFIX."posts"))
		$db->query("ALTER TABLE ".TABLE_PREFIX."posts DROP thx");
	if($db->field_exists("thx",TABLE_PREFIX."users"))
		$db->query("ALTER TABLE ".TABLE_PREFIX."users DROP thx , DROP thxcount");
	
	rebuild_settings();
	
}


function thx($post) {
	global $db, $mybb, $lang , $altbg,$templates;
	if($mybb->settings['thx_active']=="off")
		return;
		
	$lang->load("thx");
	
	$b=0; //dose user thank this post?
	$entries=build_thank($post['pid'],$b);
	
	
 	if($mybb->user['uid'] != 0 && $mybb->user['uid'] != $post['uid']) 
	{
		if(!$b)  //show thank button 
			$post['thanks'] = "<a id=\"a{$post['pid']}\" onclick=\"javascript:return thx({$post['pid']});\" href=\"showthread.php?action=thank&tid={$post['tid']}&pid={$post['pid']}\">
			<img 
			src=\"images/{$lang->language}/postbit_thx.gif\" border=\"0\" alt=\"$lang->thx_main\" id=\"i{$post['pid']}\" /></a>";
		else 
			$post['thanks'] = "<a id=\"a{$post['pid']}\" onclick=\"javascript:return rthx({$post['pid']});\" href=\"showthread.php?action=remove_thank&tid={$post['tid']}&pid={$post['pid']}\">
			<img src=\"images/{$lang->language}/postbit_rthx.gif\" border=\"0\" 
				alt=\"$lang->thx_remove\" id=\"i{$post['pid']}\" /></a>";
	
	}


	
	
		
	$display= $entries ?  "": "none" ;
		
	
	$post['thxdsp'] =  "<tr id=\"thx{$post['pid']}\" style=\"display:$display\"><td width=\"15%\" class=\"$altbg\" align=\"center\">
							<span class=\"smalltext\">$lang->thx_givenby</span></td>
							<td width=\"15%\" id=\"thx_list{$post['pid']}\" class=\"$altbg\">$entries</td></tr>";
	
	if($mybb->settings['thx_count']=="on")
	{
		$query=$db->simple_select(TABLE_PREFIX."users","thx ,thxcount ","uid={$post['uid']}");
		$count1=$db->fetch_array($query);
		
		$query=$db->simple_select(TABLE_PREFIX."posts","count(*) as count","thx > '0' AND uid={$post['uid']}"); 
		$count3=$db->fetch_array($query);
		
		$post['thank_count']=$count1['thx'];
		$post['thanked_count']=sprintf($lang->thx_thanked_count,$count1['thxcount'],$count3['count']);
		eval("\$post['thxcount'] = \"".$templates->get("postbit_thxcount")."\";");
		$post['user_details'].=$post['thxcount'];
	}
	
	
}

function do_action() {
	global $mybb, $db, $lang;
	
	if( ($mybb->input['action'] != "thankyou"  &&  $mybb->input['action'] != "remove_thankyou")
		|| $mybb->request_method != "post")
		return;
		
	
	$lang->load("thx");
	$pid=intval($mybb->input['pid']);
	
	if ($mybb->input['action'] == "thankyou" )
		do_thank($pid); 
	else 
		del_thank($pid);
		
	$nonead=0;
	$list=build_thank($pid,$nonead);
	header('Content-Type: text/xml');
	$output="<thankyou>
				<list><![CDATA[$list]]></list>
				<display>".($list ? "1" : "0")."</display>
				<image>{$mybb->settings['bburl']}/images/{$lang->language}/";
	$output.=$mybb->input['action'] == "thankyou" ? "postbit_rthx.gif": "postbit_thx.gif";  			
	$output.="</image>
			 </thankyou>";
	echo $output;
	
	
	
}

function direct_action()
{
	
	global $mybb,$lang;
	if($mybb->input['action'] != "thank"  &&  $mybb->input['action'] != "remove_thank")
		return;
		
	$lang->load("thx");
	$pid=intval($mybb->input['pid']);
	
	if ($mybb->input['action'] == "thank" )
		do_thank($pid); 
	else
		del_thank($pid);
		
	redirect($_SERVER['HTTP_REFERER']);
	
}

function build_thank($pid,&$is_thx)
{
	$is_thx=0;
	global $db,$mybb;
	$query=$db->query( "SELECT  th.* , u.username ,u.usergroup ,u.displaygroup
						FROM ".TABLE_PREFIX."thx th
						JOIN ".TABLE_PREFIX."users u ON(th.adduid=u.uid)
						WHERE th.pid='$pid'
						ORDER BY th.time ASC");
	
	

	while($record = $db->fetch_array($query))
	{
		$is_thx+=$record['adduid']==$mybb->user['uid'];
		$date=my_date($mybb->settings['dateformat'].' '.$mybb->settings['timeformat'],$record['time']);
		$url=get_profile_link($record['adduid']);
		$name=format_name($record['username'], $record['usergroup'], $record['displaygroup']);
		$entries .= "".$r1comma."<a href=\"$url\">$name</a> <span class=\"smalltext\">(".$date.")</span>";
			
		$r1comma =", ";
	}
	
	return $entries;
}

function do_thank($pid)
{
	global $db,$mybb;
	$check_query = $db->simple_select(TABLE_PREFIX."thx","*" ,"adduid='{$mybb->user['uid']}' AND pid='$pid'");
	if($db->num_rows($check_query))
		return;
	$check_query = $db->simple_select(TABLE_PREFIX."posts","uid","pid='$pid'");
	if($db->num_rows($check_query)==1)//  post exsits
	{
		$tmp=$db->fetch_array($check_query);	
		$database = array (
			"uid" =>$tmp['uid'], 
			"adduid" => $mybb->user['uid'],
			"pid" => $pid,
			"time" => time()
		);
		$db->insert_query(TABLE_PREFIX."thx", $database); //add thank to thx table
		
		
		//update user inforamtion
		$query=$db->simple_select(TABLE_PREFIX."users","thx","uid={$mybb->user['uid']}");
		$tmp=$db->fetch_array($query);
		
		$update1['thx']=++$tmp['thx'];
		$db->update_query(TABLE_PREFIX."users",$update1,"uid={$mybb->user['uid']}",1);
		
		$query=$db->simple_select(TABLE_PREFIX."users","thxcount","uid={$database['uid']}");
		$tmp=$db->fetch_array($query);

		$update2['thxcount']=++$tmp['thxcount'];
		$db->update_query(TABLE_PREFIX."users",$update2,"uid={$database['uid']}",1);
		
		//update post information
		$update3['thx']="1";
		$db->update_query(TABLE_PREFIX."posts",$update3,"pid={$database['pid']}",1);
	}	
}

function del_thank($pid)
{
	global $mybb,$db;
	$check_query = $db->simple_select(TABLE_PREFIX."thx","*" ,"adduid='{$mybb->user['uid']}' AND pid='$pid'");
	if($db->num_rows($check_query))
	{
		$data=$db->fetch_array($check_query);
		$query=$db->simple_select(TABLE_PREFIX."users","thx","uid={$mybb->user['uid']}");
		$tmp=$db->fetch_array($query);

		$update1['thx']=--$tmp['thx'];
		$db->update_query(TABLE_PREFIX."users",$update1,"uid={$mybb->user['uid']}",1);
				
		$query=$db->simple_select(TABLE_PREFIX."users","thxcount","uid={$data['uid']}");
		$tmp=$db->fetch_array($query);
		--$tmp['thxcount'];
		$update2['thxcount']="{$tmp['thxcount']}";
		$db->update_query(TABLE_PREFIX."users",$update2,"uid={$data['uid']}",1);

		
		$db->delete_query(TABLE_PREFIX."thx","adduid='{$mybb->user['uid']}' AND pid='$pid'");
		
		
		/*$db->query("UPDATE ".TABLE_PREFIX."posts p SET p.thx=(SELECT count(*) FROM ".
				TABLE_PREFIX."thx t WHERE t.pid='{$pid}') WHERE p.pid='{$pid}'");*/

		$query=$db->simple_select(TABLE_PREFIX."thx","count(*) as c","pid='{$pid}'");
		$tmp=$db->fetch_array($query);
		$update3['thx']=$temp['c'];
		$db->update_query(TABLE_PREFIX."posts",$update3,"pid='{$pid}'",1);
	}
}

if(!function_exists("rebuild_settings"))
{
	function rebuild_settings()
	{
		global $db;
		$query = $db->query("SELECT * FROM ".TABLE_PREFIX."settings ORDER BY title ASC");
		while($setting = $db->fetch_array($query))
		{
			$setting['value'] = addslashes($setting['value']);
			$settings .= "\$settings['".$setting['name']."'] = \"".$setting['value']."\";\n";
		}
		$settings = "<?php\n/*********************************\ \n  DO NOT EDIT THIS FILE, PLEASE USE\n  THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n?>";
		$file = fopen("../inc/settings.php", "w");
		fwrite($file, $settings);
		fclose($file);
	}
}
?>

and this from thx.php from Zaher1988
<?php
/**
 * Thank you 2.0
 * Copyright TECHEX - The Site
 * http://www.thetechex.net
 */

if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
//Necessary hooks
$plugins->add_hook("postbit", "thx");
$plugins->add_hook("xmlhttp", "do_action");

function thx_info()
{
	return array(
		'name'			=> 'Thank you',
		'description'	=> 'Add a thank you note to a certain post.',
		'website'		=> 'http://www.thetechex.net',
		'author'		=> 'Zaher1988',
		'authorsite'	=> 'http://www.thetechex.net',
		'version'		=> '2.0',
	);
}

function thx_activate()
{
	global $db, $mybb;
	//Create DB table
	$query = $db->query("CREATE TABLE ".TABLE_PREFIX."thx (
		txid INT UNSIGNED NOT NULL AUTO_INCREMENT ,
		uid int( 10 ) NOT NULL ,
		adduid int( 10 ) NOT NULL ,
		pid int( 10 ) NOT NULL ,
		tid int( 10 ) NOT NULL ,
		time bigint(30) NOT NULL,
		PRIMARY KEY ( txid ) 
		) TYPE = MYISAM ;"
	);
		
	require MYBB_ROOT.'/inc/adminfunctions_templates.php';
	//Edite needed templates
	find_replace_templatesets("postbit", '#'.preg_quote('{$seperator}').'#', '{$post[\'thxdsp\']}{$seperator}');
	find_replace_templatesets("postbit", '#'.preg_quote('{$post[\'button_quote\']}').'#', '{$post[\'button_quote\']}{$post[\'thanks\']}');
	find_replace_templatesets("headerinclude","#".preg_quote('{$newpmmsg}').'#','<script language="javascript" type="text/javascript">
function thxFunction(uid,puid,pid,tid){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Ajax request was not established!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	var txDisp = "displayThx" + pid + tid;
	var trDisp = "displayThxtr" + pid + tid;
	var ajaxDisplay = getbyID(txDisp);
	ajaxRequest.onreadystatechange = function()
	{
		if(ajaxRequest.readyState == 4)
		{
			getbyID(trDisp).style.display= \'\'; 		
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
		else
		{
			ajaxDisplay.innerHTML = \'<div><img src="./images/spinner.gif" /></div>\';
		}
	}

	var queryString = "&uid=" + uid + "&adduid=" + puid + "&pid=" + pid + "&tid=" + tid;
	ajaxRequest.open("GET", "xmlhttp.php?action=thankyou" + queryString, true);
	ajaxRequest.send(null); 

}
function getbyID(id)
{
	var box= \'\';
	if(document.all && !document.getElementById)
	{
		return box = document.all.id;
	} 
	else if(document.getElementById)
	{
		return box = document.getElementById(id);
	}
	else 
	{
		return box = document.layers[id];
	}
}
function expandCollapse(id) 
{
	var check = id.split(\'_\');
	var div =  getbyID(id);

	if(check[2] == \'e\')
	{
		if(div && div.style) 
		{
			div.style.display = \'\';
			getbyID(\'expcol_\'+id).href = getbyID(\'expcol_\'+id).href.replace(\'_e\', \'_c\');
			getbyID(\'expcol_\'+id).id = getbyID(\'expcol_\'+id).id.replace(\'_e\', \'_c\');
			div.id = div.id.replace(\'_e\', \'_c\');
		}
	}
	else
	{
		if(div && div.style) 
		{
			div.style.display = \'none\';
			getbyID(\'expcol_\'+id).href = getbyID(\'expcol_\'+id).href.replace(\'_c\', \'_e\');
			getbyID(\'expcol_\'+id).id = getbyID(\'expcol_\'+id).id.replace(\'_c\', \'_e\');
			div.id = div.id.replace(\'_c\', \'_e\');
		}
	}
}
</script>
							{$newpmmsg}');
	//installing settings
	$thx_group = array(
		"gid"			=> "NULL",
		"name"			=> "Thank you",
		"title"			=> "Thank you",
		"description"	=> "Displays thank you note below each post.",
		"disporder"		=> "3",
		"isdefault"		=> "no",
	);
	
	$db->insert_query(TABLE_PREFIX."settinggroups", $thx_group);
	$gid = $db->insert_id();
	
	
	$thx_setting_1 = array(
		"sid"			=> "NULL",
		"name"			=> "thx_max",
		"title"			=> "Max number to directly display",
		"description"	=> "Set how many thanks you want to display before the Show All button appears.",
		"optionscode"	=> "text",
		"value"			=> '5',
		"disporder"		=> '1',
		"gid"			=> intval($gid),
	);
	$db->insert_query(TABLE_PREFIX."settings", $thx_setting_1);
	rebuild_settings();
}

function thx_deactivate()
{
	global $db, $mybb;
	require MYBB_ROOT.'/inc/adminfunctions_templates.php';
	//Deleting table
	$query = $db->query("drop TABLE ".TABLE_PREFIX."thx");
	//Restoring templates
	find_replace_templatesets("postbit", '#'.preg_quote('{$post[\'thxdsp\']}').'#', '', 0);
	find_replace_templatesets("postbit", '#'.preg_quote('{$post[\'thanks\']}').'#', '', 0);
	find_replace_templatesets("headerinclude","#".preg_quote('<script language="javascript" type="text/javascript">
function thxFunction(uid,puid,pid,tid){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Ajax request was not established!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	var txDisp = "displayThx" + pid + tid;
	var trDisp = "displayThxtr" + pid + tid;
	var ajaxDisplay = getbyID(txDisp);
	ajaxRequest.onreadystatechange = function()
	{
		if(ajaxRequest.readyState == 4)
		{
			getbyID(trDisp).style.display= \'\'; 		
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
		else
		{
			ajaxDisplay.innerHTML = \'<div><img src="./images/spinner.gif" /></div>\';
		}
	}

	var queryString = "&uid=" + uid + "&adduid=" + puid + "&pid=" + pid + "&tid=" + tid;
	ajaxRequest.open("GET", "xmlhttp.php?action=thankyou" + queryString, true);
	ajaxRequest.send(null); 

}
function getbyID(id)
{
	var box= \'\';
	if(document.all && !document.getElementById)
	{
		return box = document.all.id;
	} 
	else if(document.getElementById)
	{
		return box = document.getElementById(id);
	}
	else 
	{
		return box = document.layers[id];
	}
}
function expandCollapse(id) 
{
	var check = id.split(\'_\');
	var div =  getbyID(id);

	if(check[2] == \'e\')
	{
		if(div && div.style) 
		{
			div.style.display = \'\';
			getbyID(\'expcol_\'+id).href = getbyID(\'expcol_\'+id).href.replace(\'_e\', \'_c\');
			getbyID(\'expcol_\'+id).id = getbyID(\'expcol_\'+id).id.replace(\'_e\', \'_c\');
			div.id = div.id.replace(\'_e\', \'_c\');
		}
	}
	else
	{
		if(div && div.style) 
		{
			div.style.display = \'none\';
			getbyID(\'expcol_\'+id).href = getbyID(\'expcol_\'+id).href.replace(\'_c\', \'_e\');
			getbyID(\'expcol_\'+id).id = getbyID(\'expcol_\'+id).id.replace(\'_c\', \'_e\');
			div.id = div.id.replace(\'_c\', \'_e\');
		}
	}
}
</script>
							{$newpmmsg}').'#','{$newpmmsg}',0);
	//Delete settings
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='thx_max'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='Thank you'");
	rebuild_settings();
}


function thx($post) 
{
	global $db, $mybb, $lang;
	
	$lang->load("thx");

	//Start adding necessary buttons to postbit
	$uid = $mybb->user['uid'];

 	if($mybb->user['uid'] != 0 && $mybb->user['uid'] != $post['uid']) 
	{
		$post['thanks'] = "<a href=\"javascript:thxFunction({$uid},{$post['uid']},{$post['pid']},{$post['tid']})\"><img src=\"images/english/postbit_thx.gif\" border=\"0\" alt=\"{$lang->thx_main}\" /></a>";
	}
	
	//Show row for each postbit
	$post['thxdsp'] = build_thxlot($post['pid'],$post['tid']);
}
//Build up the row of the thanks notes
function build_thxlot($pid,$tid)
{
	global $post, $altbg, $lang;

	//Read entries
	$entries = read_entries($pid,$tid,"f");

	//Show or hide thanks row
	if(!$entries) 
	{
		$css_display = "none";
	} else {
		$css_display = "";
	}

	$display = "<tr id=\"displayThxtr{$post['pid']}{$post['tid']}\" style=\"display:{$css_display}\"><td class=\"{$altbg}\" align=\"center\" colspan=\"2\"><div id=\"displayThx{$post['pid']}{$post['tid']}\">{$entries}</div></td></tr>";
	//return row
	return $display;
}
//Do the hidden work
function do_action() 
{
	global $mybb, $pid, $tid, $db, $lang, $theme;
	$lang->load("thx");
	
	if ($mybb->input['action'] == "thankyou") 
	{		
		$pid = $_GET['pid'];
		$tid = $_GET['tid'];
		$uid = $_GET['uid'];

		$check_query = $db->query("SELECT * FROM ".TABLE_PREFIX."thx WHERE uid='".intval($uid)."' AND  tid='".intval($tid)."' AND pid='".intval($pid)."'");
		$check = $db->num_rows($check_query);

		if ($check == 0) 
		{
			$database = array (
				"txid" => "NULL",
				"uid" => $mybb->user['uid'],
				"adduid" => $_GET['adduid'],
				"pid" => $_GET['pid'],
				"tid" => $_GET['tid'],
				"time" => time()
			);
			//Insert entry to DB
			$query = $db->insert_query(TABLE_PREFIX."thx", $database);

			
			//Output entries to row
			
			echo "<html><head><script type=\"text/javascript\" src=\"jscripts/prototype.lite.js?ver=121\"></script><script type=\"text/javascript\" src=\"jscripts/general.js?ver=121\"></script><link rel=\"stylesheet\" type=\"text/css\" href=\"{$theme['css_url']}\" /></head><body>".read_entries($pid,$tid,"p")."</body></html>";
		} 
		else  
		{
			echo $lang->thx_error;
		}
			
	}
}

//Let's read the specified entries from the DB
function read_entries($pid,$tid,$type)
{
	global $db, $entries, $mybb, $showall, $additional, $lang;

	//Reset entries list
	$entries = "";
	$entries2 = "";

	//Get all entries
	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."thx WHERE pid='$pid' AND tid='$tid' ORDER BY time DESC");

	$counter = 0;
	while($ft = $db->fetch_array($query))
	{
		$query2 = $db->query("SELECT * FROM ".TABLE_PREFIX."users WHERE uid='".$ft['uid']."'");
		while ($ft2 = $db->fetch_array($query2))
		{
			$date = gmdate("M-j-Y", $ft['time']);

			//Check if we need to hide/show X number set in the settings panel
			if($counter < $mybb->settings['thx_max']) 
			{
				$entries .= $r1comma."<a href=\"member.php?action=profile&amp;uid=".$ft2['uid']."\">".format_name($ft2[username], $ft2['usergroup'], $dt2['displaygroup'])."</a> <span class=\"smalltext\">(".$date.")</span>";	
			} 
			else 
			{
				$entries2 .= $r2comma."<a href=\"member.php?action=profile&amp;uid=".$ft2['uid']."\">".format_name($ft2[username], $ft2['usergroup'], $dt2['displaygroup'])."</a> <span class=\"smalltext\">(".$date.")</span>";
				$r2comma =", ";
			}
			$r1comma =", ";
		}
		$counter++;
	}
	if($entries2 == "" && $entries != "")
	{
		$entries = "<div class=\"smalltext\" style=\"float:left;width:20%\">{$lang->thx_givenby}</div><div align=\"left\">{$entries}</div>";
		return $entries;
	} 
	elseif($entries2 != "" && $entries != "") 
	{
		
		$additional = "<div style=\"display:none\" id=\"thx_{$pid}_e\" align=\"left\">{$entries2}</div>";
		
		$entrieslist = "<div class=\"smalltext\" style=\"float:left;width:20%\">{$lang->thx_givenby}</div><div align=\"left\">{$entries}&nbsp;<a href=\"javascript:expandCollapse('thx_{$pid}_e');\" id=\"expcol_thx_{$pid}_e\">....</a></div>{$additional}";
		return $entrieslist;
	} 
	else 
	{
		$entries =""; // just to make sure
		return $entries;
	}
	
}

//Function to rebuilt all settings
if(!function_exists("rebuild_settings"))
{
	function rebuild_settings()
{
	global $db, $mybb;

	if(!file_exists(MYBB_ROOT."inc/settings.php"))
	{
		$mode = "x";
	}
	else
	{
		$mode = "w";
	}
	$options = array(
		"order_by" => "title",
		"order_dir" => "ASC"
	);
	$query = $db->simple_select(TABLE_PREFIX."settings", "value, name", "", $options);

	while($setting = $db->fetch_array($query))
	{
		$setting['value'] = str_replace("\"", "\\\"", $setting['value']);
		$settings .= "\$settings['".$setting['name']."'] = \"".$setting['value']."\";\n";
		$mybb->settings[$setting['name']] = $setting['value'];
	}
	$settings = "<"."?php\n/*********************************\ \n  DO NOT EDIT THIS FILE, PLEASE USE\n  THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n?".">";
	$file = @fopen(MYBB_ROOT."inc/settings.php", $mode);
	@fwrite($file, $settings);
	@fclose($file);
	$GLOBALS['settings'] = &$mybb->settings;
	}

}
?>

at thanks buttom arash i see like this
http://bravoes.com/showthread.php?action=thank&tid=522&pid=2546

but at thanks buttom zaher is
javascript:thxFunction(8,11,2564,522)

i dont know where i have problem

iam installed with readme.txt guide

i hope this problem be solved soon. thanks
any body give me solved?
Pages: 1 2