Name:		Popular Contents Today & Yesterday 1.0
Datum:		20-03-2009
Author: 	Crack
Homepage:	www.kit-coding.de
Email: 		Info@kit-coding.de


---------------------------------------------------------------------------------------------------
INSTALL HowTo Popular Contents Today & Yesterday 1.0
---------------------------------------------------------------------------------------------------

 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 10 Dateien 


/pkinc/public/download.php
/pkinc/public/link.php
/pkinc/public/news.php
/pkinc/public/article.php
/pkinc/public/contentarchive.php
/pkinc/publictpl/content/overview_page4.htm
/pkinc/publictpl/content/overview_page3.htm
/pkinc/publictpl/content/overview_page2.htm
/pkinc/publictpl/content/overview_page1.htm
/pkinc/etc/sql.php

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

/pkinc/public/download.php

Suche:

if($download && $download!=$config['content_downloadpath'].'/')
						{

Fge Darunter ein:

#Popular Contents Stats Live ANFANG
						$daytimer=pkTIMETODAY;
						$exist_entrie=$SQL->fetch_array($SQL->query("SELECT * FROM `".pkSQLTAB_POPULAR_STATS."` WHERE `dst_cms_time`='".$daytimer."' AND dst_content_id='".$contentid."'  LIMIT 1"));
						if (empty($exist_entrie)){
							$idup=$SQL->insert_id();
							$SQL->query("Insert Into `".pkSQLTAB_POPULAR_STATS."` 
							(`dst_id`,`dst_content_id`,`dst_content_type`,`dst_content_time`,`dst_content_counter`,`dst_cms_time`) 
							VALUES 
							('".$idup."','".$contentid."','4','".pkTIME."','1','".$daytimer."')");	
						}else{
							$SQL->query("UPDATE `".pkSQLTAB_POPULAR_STATS."` set `dst_content_counter`=dst_content_counter+1, `dst_content_time`='".pkTIME."' WHERE `dst_content_id`='".$contentid."' AND dst_cms_time='".$daytimer."' limit 1");
						}
						#Popular Contents Live ENDE
=======================================================================

/pkinc/public/link.php

Suche:

$SQL->query("UPDATE ".pkSQLTAB_CONTENT." 
	SET content_views=content_views+1
	WHERE content_id='".$contentid."'");


Fge darunter ein:

#Popular Contents Stats Live ANFANG
$daytimer=pkTIMETODAY;
$exist_entrie=$SQL->fetch_array($SQL->query("SELECT * FROM `".pkSQLTAB_POPULAR_STATS."` WHERE `dst_cms_time`='".$daytimer."' AND dst_content_id='".$contentid."'  LIMIT 1"));
if (empty($exist_entrie)){
	$idup=$SQL->insert_id();
	$SQL->query("Insert Into `".pkSQLTAB_POPULAR_STATS."` 
	(`dst_id`,`dst_content_id`,`dst_content_type`,`dst_content_time`,`dst_content_counter`,`dst_cms_time`) 
	VALUES 
	('".$idup."','".$contentid."','3','".pkTIME."','1','".$daytimer."')");	
}else{
	$SQL->query("UPDATE `".pkSQLTAB_POPULAR_STATS."` set `dst_content_counter`=dst_content_counter+1, `dst_content_time`='".pkTIME."' WHERE `dst_content_id`='".$contentid."' AND dst_cms_time='".$daytimer."' limit 1");
}
#Popular Contents Live ENDE

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

/pkinc/public/news.php

Suche:

else
			{
			$sqlcommand="SELECT user_nick, user_id FROM ".pkSQLTAB_USER." WHERE user_id='".$contentinfo['content_autorid']."'";
			}
		}
	}

Fge darunter ein:

#Popular Contents Stats Live ANFANG
if ($_GET['contentid'])
{
	$daytimer=pkTIMETODAY;
	$exist_entrie=$SQL->fetch_array($SQL->query("SELECT * FROM `".pkSQLTAB_POPULAR_STATS."` WHERE `dst_cms_time`='".$daytimer."' AND dst_content_id='".$contentid."'  LIMIT 1"));
	if (empty($exist_entrie)){
		$idup=$SQL->insert_id();
		$SQL->query("Insert Into `".pkSQLTAB_POPULAR_STATS."` 
		(`dst_id`,`dst_content_id`,`dst_content_type`,`dst_content_time`,`dst_content_counter`,`dst_cms_time`) 
		VALUES 
		('".$idup."','".$contentid."','2','".pkTIME."','1','".$daytimer."')");	
	}else{
		$SQL->query("UPDATE `".pkSQLTAB_POPULAR_STATS."` set `dst_content_counter`=dst_content_counter+1, `dst_content_time`='".pkTIME."' WHERE `dst_content_id`='".$contentid."' AND dst_cms_time='".$daytimer."' limit 1");
	}
		
}
#Popular Contents Live ENDE

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

/pkinc/public/article.php

Suche:

$suggest_url=urlencode('path=article&contentid='.$contentinfo['content_id'].'&page='.$page);

Fge darunter ein:

#Popular Contents Stats Live ANFANG
$daytimer=pkTIMETODAY;
$exist_entrie=$SQL->fetch_array($SQL->query("SELECT * FROM `".pkSQLTAB_POPULAR_STATS."` WHERE `dst_cms_time`='".$daytimer."' AND dst_content_id='".$contentid."'  LIMIT 1"));
if (empty($exist_entrie)){
	$idup=$SQL->insert_id();
	$SQL->query("Insert Into `".pkSQLTAB_POPULAR_STATS."` 
	(`dst_id`,`dst_content_id`,`dst_content_type`,`dst_content_time`,`dst_content_counter`,`dst_cms_time`) 
	VALUES 
	('".$idup."','".$contentid."','1','".pkTIME."','1','".$daytimer."')");	
}else{
	$SQL->query("UPDATE `".pkSQLTAB_POPULAR_STATS."` set `dst_content_counter`=dst_content_counter+1, `dst_content_time`='".pkTIME."' WHERE `dst_content_id`='".$contentid."' AND dst_cms_time='".$daytimer."' limit 1");
}
#Popular Contents Live ENDE

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

/pkinc/public/contentarchive.php

Suche:

		unset($content_rating);
		unset($file_size);
		unset($content_rating_info);
		unset($contenttheme_info);
		unset($content_catimage);
		unset($content_rate);
		unset($content_rating_info);
		unset($content_comment);
		unset($ccounter);
		unset($content_comment_count);
		}
	}

Fge darunter ein:

	#Popular Contents Stats Live ANFANG
		$daytimer=pkTIMETODAY;
		$day_yesterday=$daytimer - 86400;
		
		#Alte Inhalte bereinigen
		$SQL->query("DELETE FROM `".pkSQLTAB_POPULAR_STATS."` WHERE `dst_cms_time`<'".$day_yesterday."' ");
			
		if($type==4)
			$lnk='download';
		elseif($type==3)
			$lnk='link';
		elseif($type==2)
			$lnk='news';
		else
			$lnk='article';
			
		#heute
		$content_today_counter=$SQL->fetch_array($SQL->query("SELECT MAX(dst_content_counter) FROM `".pkSQLTAB_POPULAR_STATS."` WHERE `dst_cms_time`='".$daytimer."' AND `dst_content_type`='".$type."' "));
		$content_today_find=$SQL->fetch_array($SQL->query("SELECT * FROM `".pkSQLTAB_POPULAR_STATS."` WHERE `dst_cms_time`='".$daytimer."' AND dst_content_counter='".$content_today_counter[0]."' AND `dst_content_type`='".$type."'"));
		$last_today=formattime($content_today_find['dst_content_time'],'','time');
		
		$content_today_load=$SQL->fetch_array($SQL->query("SELECT * FROM `".pkSQLTAB_CONTENT."` WHERE `content_id`='".$content_today_find['dst_content_id']."'"));
		if (!empty($content_today_load)){
			$cut_today_title=pkstringcut($content_today_load['content_title'],50);
			$cut_today_title=pkentities($cut_today_title);
			$contenttoday='<a href="include.php?path='.$lnk.'&amp;contentid='.$content_today_load['content_id'].'" class="small">'.$cut_today_title.'</a><img src="images/popular_contents/'.$content_type.'.png" alt="'.$content_type.'" title="'.$content_type.'" align="top" />';
			$contentext_today='<font class="headssmall"><b>'.$content_today_counter[0].' mal heute</b></font><font class="small"> - Zuletzt um '.$last_today.' Uhr</font>';
		}else{
			$contenttoday='<font style="color:#ff3333;">F&uuml;r heute liegen keine Aufzeichnungen vor.</font>';
		}
		#gestern
		$content_yesterday_counter=$SQL->fetch_array($SQL->query("SELECT MAX(dst_content_counter) FROM `".pkSQLTAB_POPULAR_STATS."` WHERE `dst_cms_time`='".$day_yesterday."' AND `dst_content_type`='".$type."'"));
		$content_yesterday_find=$SQL->fetch_array($SQL->query("SELECT * FROM `".pkSQLTAB_POPULAR_STATS."` WHERE `dst_cms_time`='".$day_yesterday."' AND dst_content_counter='".$content_yesterday_counter[0]."' AND `dst_content_type`='".$type."'"));
		$last_yesterday=formattime($content_yesterday_find['dst_content_time'],'','time');
		
		$content_yesterday_load=$SQL->fetch_array($SQL->query("SELECT * FROM `".pkSQLTAB_CONTENT."` WHERE `content_id`='".$content_yesterday_find['dst_content_id']."'"));
		if (!empty($content_yesterday_load)){
			$cut_yesterday_title=pkstringcut($content_yesterday_load['content_title'],50);
			$cut_yesterday_title=pkentities($cut_yesterday_title);
			$contentyesterday='<a href="include.php?path='.$lnk.'&amp;contentid='.$content_yesterday_load['content_id'].'" class="small">'.$cut_yesterday_title.'</a><img src="images/popular_contents/'.$content_type.'.png" alt="'.$content_type.'" title="'.$content_type.'" align="top" />';
			$contentext_yesterday='<font class="headssmall"><b>'.$content_yesterday_counter[0].' mal gestern</b></font><font class="small"> - Zuletzt um '.$last_yesterday.' Uhr</font>';
		}else{
			$contentyesterday='<font style="color:#ff3333;">F&uuml;r gestern liegen keine Aufzeichnungen vor.</font>';
		}
		
		
	#Popular Contents Stats Live ENDE

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

/pkinc/publictpl/content/overview_page4.htm

Suche:

$content_articles

Fge DARBER ein:
<!-- Popular Contents Stats Live -->
 <tr>
  <td colspan="3" class="left">
   <table border="0" cellspacing="1" cellpadding="2" width="100%" class="standard">
	<tr>
	 <td align="center" class="heads" colspan="4">Top $content_type Heute und Gestern</td>
	</tr>
	<tr>
	 <td align="left" width="50%" class="left">Beliebteste(r) $content_type heute:</td>
	 <td align="left" width="50%" class="left">Beliebteste(r) $content_type gestern:</td>
    </tr>
    <tr>
	 <td class="highlight">$contenttoday<br />$contentext_today</td>
	 <td class="highlight">$contentyesterday<br />$contentext_yesterday</td>
	</tr>
   </table>
  </td>
 </tr>
<!-- Popular Contents Stats Live -->

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

/pkinc/publictpl/content/overview_page3.htm

Suche:

$content_articles

Fge DARBER ein:
<!-- Popular Contents Stats Live -->
<tr>
  <td colspan="2" class="left">
   <table border="0" cellspacing="1" cellpadding="2" width="100%" class="standard">
	 <tr>
	  <td align="center" class="heads" colspan="4">Top $content_type Heute und Gestern</td>
	 </tr>
	 <tr>
	  <td align="left" width="50%" class="left">Beliebteste(r) $content_type heute:</td>
	  <td align="left" width="50%" class="left">Beliebteste(r) $content_type gestern:</td>
         </tr>
         <tr>
	  <td class="highlight">$contenttoday<br />$contentext_today</td>
	  <td class="highlight">$contentyesterday<br />$contentext_yesterday</td>
	 </tr>
  </table>
  </td>
 </tr>
<!-- Popular Contents Stats Live -->

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

/pkinc/publictpl/content/overview_page2.htm

Suche:

$content_articles

Fge DARBER ein:
<!-- Popular Contents Stats Live -->
<tr>
  <td colspan="2" class="left">
   <table border="0" cellspacing="1" cellpadding="2" width="100%" class="standard">
	 <tr>
	  <td align="center" class="heads" colspan="4">Top $content_type Heute und Gestern</td>
	 </tr>
	 <tr>
	  <td align="left" width="50%" class="left">Beliebteste(r) $content_type heute:</td>
	  <td align="left" width="50%" class="left">Beliebteste(r) $content_type gestern:</td>
         </tr>
         <tr>
	  <td class="highlight">$contenttoday<br />$contentext_today</td>
	  <td class="highlight">$contentyesterday<br />$contentext_yesterday</td>
	 </tr>
  </table>
  </td>
 </tr>
<!-- Popular Contents Stats Live -->

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

/pkinc/publictpl/content/overview_page1.htm

Suche:

$content_articles

Fge DARBER ein:
<!-- Popular Contents Stats Live -->
<tr>
  <td colspan="6" class="left">
   <table border="0" cellspacing="1" cellpadding="2" width="100%" class="standard">
	 <tr>
	  <td align="center" class="heads" colspan="4">Top $content_type Heute und Gestern</td>
	 </tr>
	 <tr>
	  <td align="left" width="50%" class="left">Beliebteste(r) $content_type heute:</td>
	  <td align="left" width="50%" class="left">Beliebteste(r) $content_type gestern:</td>
         </tr>
         <tr>
	  <td class="highlight">$contenttoday<br />$contentext_today</td>
	  <td class="highlight">$contentyesterday<br />$contentext_yesterday</td>
	 </tr>
  </table>
  </td>
 </tr>
<!-- Popular Contents Stats Live -->

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

/pkinc/etc/sql.php

Suche:

?>

Fge DARBER ein:

#Popular Contents Stats Live ANFANG
define('pkSQLTAB_POPULAR_STATS',pkSQLPREFIX.'_popular_stats');
#Popular Contents Stats Live 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!!!
