Name:		Foren - Bedankomat V1.3
Datum:		26-11-2008
Author: 	Cracky
Homepage:	www.kit-coding.de
Email: 		Info@kit-coding.de


---------------------------------------------------------------------------------------------------
INSTAL HowTo Foren Bedankomat
---------------------------------------------------------------------------------------------------

 
1. Lade alle Ordner unter Beibehaltung der Ordnerstruktur hoch. Dabei werden keine Dateien berschrieben ;)
2. Fhren Sie die install.php aus. Sie mssen Adminrechte besitzen!!! z.b. -> http://www.deineurl.de/include.php?path=install
3. ndere nun folgende 5 Dateien 

/pkinc/public/forumsthread.php
/pkinc/public/forumsnewpost.php
/pkinc/publictpl/forum/showthread.htm
/pkinc/publictpl/forum/showthread_row.htm
/pkinc/publictpl/forum/newpost.htm


Die Dankes Topliste kann ber ?path=toplist aufgerufen werden. Oder aber ber den Link bei Danke erhalten im Forum bei dem jeweiligen Posting.


=======================================================================

/pkinc/public/forumsthread.php

Suche:

elseif($userinfo['user_status']=="mod")
				eval("\$post_autor_status= \"".pkTpl("forum/showthread_userstatus_mod")."\";");


Fge darunter ein:

			#Bedankomat by www.kit-coding.de ANFANG
			$checktrue=$SQL->fetch_array($SQL->query("SELECT `forumthread_dankomat` FROM `".pkSQLTAB_FORUM_THREAD."` WHERE `forumthread_id`='".$forumpost['forumpost_threadid']."' LIMIT 1 "));
			if(getrights('user') && $checktrue['forumthread_dankomat']!="0" ){
				
				$loadthanksinfo=$SQL->fetch_array($SQL->query("SELECT * FROM `".pkSQLPREFIX."_forumthanks` WHERE thank_foruser='".$userinfo['user_id']."' && thank_threadid='".$forumpost['forumpost_threadid']."' && thank_postid='".$forumpost['forumpost_id']."'  LIMIT 1 "));  
				$useridthank=$SQL->fetch_array($SQL->query("SELECT user_id,user_nick FROM `".pkSQLTAB_USER."` WHERE user_id='".$loadthanksinfo['thank_last']."' LIMIT 1 "));  
				if(!empty($useridthank)){
					eval("\$lastthankyou= \"".pkTpl("member_showprofil_textlink_thank")."\";");			
				}
				else{
						if ($loadthanksinfo['thank_last']==''){
							$lastthankyou='noch niemand...';
						}
						else{
							$load=$SQL->fetch_array($SQL->query("SELECT forumpost_autor  FROM `".pkSQLTAB_FORUM_POST."` WHERE `forumpost_threadid`='".$loadthanksinfo['thank_threadid']."' AND forumpost_autorid='".$loadthanksinfo['thank_last']."' LIMIT 1 "));
							$lastthankyou=$load['forumpost_autor'];
						}
					}
						
				$lastthankyoupost=$SQL->fetch_array($SQL->query("SELECT * FROM `".pkSQLPREFIX."_forumthanks` WHERE thank_postid ='".$forumpost['forumpost_id']."' LIMIT 1 "));
				if(empty($lastthankyoupost))
					$lastthankyoupost['thank_revive']='0';
				
				#Prfung ob der Eintrag von einem selbst ist
				if($forumpost['forumpost_autorid']!=pkGetUservalue('id')){
						eval("\$thankpostlnk= \"".pkTpl("forum/forum_thankpostlnk")."\";");
				}
																		
				$thankrevieve='<tr><td nowrap><font class="small">Danke erhalten: '.$userinfo['user_thanks'].' <a href="include.php?path=toplist&id='.$userinfo['user_id'].'">Anzeigen!</a></font></td></tr>';
				eval("\$thankinfos= \"".pkTpl("forum/forum_thankinfos")."\";");
			}
			else{$thankrevieve='<tr><td nowrap><font class="small">Danke erhalten: '.$userinfo['user_thanks'].' <a href="include.php?path=toplist&id='.$userinfo['user_id'].'">Anzeigen!</a></font></td></tr>';}
			#Bedankomat by www.kit-coding.de ENDE

Suche weiter:

unset($avatar_show);

Fge darunter ein:

#Bedankomat by www.kit-coding.de ENDE
		unset($thankpostlnk);
		unset($thankinfos);
		unset($thankrevieve);
		#Bedankomat by www.kit-coding.de ENDE


Suche weiter (Miau):

eval("\$showthread_quickmod=\"".pkTpl("forum/showthread_quickmod")."\";");

		eval("\$thread_moderate=\"".pkTpl("forum/showthread_moderate")."\";");
		}
	}

Fge darunter ein:

#Bedankomat by www.kit-coding.de ANFANG

		if(getrights('user') && $checktrue['forumthread_dankomat']!="0" ){
			
			if ($_GET['thanks']=='add' && intval($_GET['threadid'])>0 && intval($_GET['pid']) ) {
					$loadthankusers=$SQL->fetch_array($SQL->query("SELECT * FROM `".pkSQLPREFIX."_forumthanks` WHERE `thank_postid`='".$SQL->i($_GET['pid'])."' LIMIT 1"));			
				    $thank_userinfo=$loadthankusers['thank_user'];
				    
					if(pkGetUservalue('id')){
						$userid=pkGetUservalue('id');
						$thank_user=$thank_userinfo.$userid."\n";
					}
										
					#Prfung ob Eintrag vorhanden & Dankespamschutz
					$insertyesno=$SQL->fetch_array($SQL->query("SELECT * FROM `".pkSQLPREFIX."_forumthanks` WHERE `thank_postid`='".$SQL->i($_GET['pid'])."' LIMIT 1"));
						if (empty($insertyesno))
						{
							$idup=$SQL->insert_id();
							$SQL->query("Insert Into `".pkSQLPREFIX."_forumthanks` (`thank_id`,`thank_postid`, `thank_threadid`, `thank_user`, `thank_last`, `thank_foruser`) VALUES ('".$SQL->i($idup)."','".$SQL->i($_GET['pid'])."', '".$SQL->i($forumpost['forumpost_threadid'])."', '".$thank_user."','".$SQL->i(pkGetUservalue('id'))."', '".$SQL->i($_GET['uid'])."' )");
							$SQL->query("UPDATE `".pkSQLPREFIX."_forumthanks` set `thank_revive`=thank_revive+1 WHERE `thank_postid`='".$SQL->i($_GET['pid'])."' limit 1");
							$SQL->query("UPDATE `".pkSQLTAB_USER."` set `user_thanks`=user_thanks+1 WHERE `user_id`='".$SQL->i($_GET['uid'])."' limit 1");
							pkHeaderLocation('forumsthread&threadid='.$_GET['threadid'].'&entries='.$entries.'#post'.$_GET['pid'].'');
						}
						else
						{
							
							if (!preg_match("#".pkGetUservalue('id')."\n#is",  $thank_userinfo)){
							$SQL->query("UPDATE `".pkSQLTAB_USER."` set `user_thanks`=user_thanks+1 WHERE `user_id`='".$SQL->i($_GET['uid'])."' limit 1");
							$SQL->query("UPDATE `".pkSQLPREFIX."_forumthanks` set `thank_revive`=thank_revive+1, `thank_last`='".$userid."' , `thank_user`='".$thank_user."' WHERE `thank_postid`='".$SQL->i($_GET['pid'])."' limit 1");
							}
							
							pkHeaderLocation('forumsthread&threadid='.$_GET['threadid'].'&entries='.$entries.'#post'.$_GET['pid'].'');
							
						}
			}
			
			eval("\$thankalllnk= \"".pkTpl("forum/forum_thankalllnk")."\";");
			
			$getuserinfo=$SQL->query("SELECT * FROM `".pkSQLTAB_USER."` ORDER by user_id ASC");
				while($userinfo=$SQL->fetch_array($getuserinfo)){
					$userinfo_cache[$userinfo[user_id]]=$userinfo;
				}
	
			$loadallthanksforhtread=$SQL->query("SELECT thank_user FROM `".pkSQLPREFIX."_forumthanks` WHERE `thank_threadid`='".$SQL->i($_GET['threadid'])."'");
			while($allthanksforhtread=$SQL->fetch_array($loadallthanksforhtread)){
			
				$p=$allthanksforhtread['thank_user'];
				$info=explode("\n",$p);
						
				if(is_array($info)){
					foreach($info as $id){
						$id=trim($id);
						
						if($id!=''){
							$show=pkEntities($userinfo_cache[$id]['user_nick']);
							$show2=pkEntities($userinfo_cache[$id]['user_id']);
								if (!preg_match("#id=".$show2."#",$thanks) && $show2!=''){
									eval("\$thanks.= \"".pkTpl("member_showprofil_textlink_thank_list")."\";");
									$thanks.=', ';
								}
						}
					}
				}
					
			}
			
			if ($thanks=="")
			{$thanks="Es hat sich noch niemand fr einen der Postings in diesem Thread bedankt!";}
			
			eval("\$listthankstable= \"".pkTpl("forum/forum_listallthanks")."\";");
		}
#Bedankomat by www.kit-coding.de ENDE

=======================================================================

/pkinc/public/forumsnewpost.php

Suche:

$threadid=$DB->insert_id();
				$update_threadcount=", forumcat_threadcount=forumcat_threadcount+1";

Fge darunter ein:

#Bedankomat by www.kit-coding.de ANFANG
					if(intval($_POST['post_dankomat'])==1 || $ACTION=='save'){
						$SQL->query("UPDATE ".$db_tab['forumthread']." set `forumthread_dankomat`='1' WHERE `forumthread_id`='".$threadid."' limit 1");
					}
					#Bedankomat by www.kit-coding.de ENDE

Suche weiter (zzzzzz):

			eval("\$sign_format= \"".pkTpl("format_text_comcat")."\";");
			eval("\$option_bbcode= \"".pkTpl("forum/newpost_option_bbcode")."\";");
			}

Fge darunter ein:

#Bedankomat by www.kit-coding.de ANFANG
		if(intval($_POST['post_dankomat'])==1 || $ACTION=='view'){
			$dankomat='checked';
		}
		
		if($threadid<=0)
			{eval("\$option_dankomat= \"".pkTpl("forum/newpost_option_dankomat")."\";");}
		
		#Bedankomat by www.kit-coding.de ENDE

=======================================================================

/pkinc/publictpl/forum/showthread.htm

Suche:

<td class="sitebodysmall"><a class="sitebodysmall" href="include.php?path=forumsjump&prev=$threadid&remove_path=$removeto">vorheriges Thema</a> &nbsp; <a class="sitebodysmall" href="include.php?path=forumsjump&next=$threadid&remove_path=$removeto">n&auml;chstes Thema</a></td>
<td class="sitebodysmall" align="right">&#160;</td>

ERSETZE mit:

<td class="sitebodysmall"><a class="headssmall" href="include.php?path=forumsjump&prev=$threadid&remove_path=$removeto">vorheriges Thema</a> &nbsp; <a class="headssmall" href="include.php?path=forumsjump&next=$threadid&remove_path=$removeto">n&auml;chstes Thema</a></td>
<td class="sitebodysmall" rowspan="2">$thankalllnk</td>
<td class="sitebodysmall" align="right">&#160;</td>

Suche weiter:

</tr>
	$showthread_row
</table>

Fge darunter ein (Du machst das TOLL ^^ ):

<!-- Bedankomat by www.kit-coding.de ANFANG -->
$listthankstable
<!-- Bedankomat by www.kit-coding.de ENDE -->

=======================================================================

/pkinc/publictpl/forum/showthread_row.htm

Suche:

<tr>
	  <td>$avatar_show</td>
	 </tr>

Fge darunter ein:

<!-- Bedankomat by www.kit-coding.de ANFANG-->
         $thankrevieve
         $thankinfos 
<!-- Bedankomat by www.kit-coding.de ENDE-->


Suche weiter (fast geschafft!):

$info_icq

Ersetze mit:

$info_icq $thankpostlnk



=======================================================================

/pkinc/publictpl/forum/newpost.htm

Suche:

$option_vote

Fge darunter ein:


<!-- Bedankomat by www.kit-coding.de ANFANG-->
$option_dankomat
<!-- Bedankomat by www.kit-coding.de ENDE-->


=======================================================================

Das war es auch schon.

Juhu


Support:
============================

Support & Fragen: 

Support gebe ich gerne im FORUM unter www.kit-coding.de 
PNS oder ICQ werden gnadenlos ignoriert!!!
