".$query."<-");
		$result = mysql_query($query);

		while($tmp = mysql_fetch_assoc($result))
		{
		  $data[] = $tmp;
		}

		if ($domore>0)
		{
			for ($i=0; $i27):
  					if (strlen($data[$i]["groupname1"])>10 && $data[$i]["groupacron1"]) $data[$i]["groupname1"]=$data[$i]["groupacron1"];
  					if (strlen($data[$i]["groupname2"])>10 && $data[$i]["groupacron2"]) $data[$i]["groupname2"]=$data[$i]["groupacron2"];
  					if (strlen($data[$i]["groupname3"])>10 && $data[$i]["groupacron3"]) $data[$i]["groupname3"]=$data[$i]["groupacron3"];
  				endif;

				$query="select platforms.name from prods_platforms, platforms where prods_platforms.prod='".$data[$i]["id"]."' and platforms.id=prods_platforms.platform";
	  			$result=mysql_query($query);
	  			$check=0;
	  			$data[$i]["platform"]="";
	  			while($tmp = mysql_fetch_array($result)) {
				  if ($check>0) $data[$i]["platform"].=",";
				  $check++;
				  $data[$i]["platform"].=$tmp["name"];
				 }

			endfor;

		}

		$fp = fopen("../include/".$name.".cache.inc", "wb");
		fwrite($fp, "27)
						$v2 = substr($v2,0,27)."...";
					//if($k2=="groupname1"&&strlen($v2)>20)
					//	$v2 = substr($v2,0,15)."...";
					$v2 = addslashes($v2);
					$v2 = str_replace("$","\\\$",$v2);
					//$v2 = preg_replace('/&#\d{2,5};/ue', "utf8_entity_decode('$0')", $v2 );
  				fwrite($fp, "\$".$name."[".$k."][\"".$k2."\"]=\"".$v2."\";\n");
				}
				fwrite($fp, "\n");
			}
		}
    		fwrite($fp, "?>\n");
		fclose($fp);
	}

function create_stats_cache()
	{
		$query="SELECT count(0) FROM prods";
		$result=mysql_query($query);
		$nb_demos=mysql_result($result,0);
		$query="SELECT count(0) FROM prods WHERE (UNIX_TIMESTAMP()-UNIX_TIMESTAMP(quand))<=3600*24";
		$result=mysql_query($query);
		$inc_demos=mysql_result($result,0);

		$query="SELECT count(0) FROM groups";
		$result=mysql_query($query);
		$nb_groups=mysql_result($result,0);
		$query="SELECT count(0) FROM groups WHERE (UNIX_TIMESTAMP()-UNIX_TIMESTAMP(quand))<=3600*24";
		$result=mysql_query($query);
		$inc_groups=mysql_result($result,0);

		$query="SELECT count(0) FROM parties";
		$result=mysql_query($query);
		$nb_parties=mysql_result($result,0);
		$query="SELECT count(0) FROM parties WHERE (UNIX_TIMESTAMP()-UNIX_TIMESTAMP(quand))<=3600*24";
		$result=mysql_query($query);
		$inc_parties=mysql_result($result,0);

		$query="SELECT count(0) FROM bbses";
		$result=mysql_query($query);
		$nb_bbses=mysql_result($result,0);
		$query="SELECT count(0) FROM bbses WHERE (UNIX_TIMESTAMP()-UNIX_TIMESTAMP(added))<=3600*24";
		$result=mysql_query($query);
		$inc_bbses=mysql_result($result,0);

		$query="SELECT count(0) FROM users";
		$result=mysql_query($query);
		$nb_users=mysql_result($result,0);
		$query="SELECT count(0) FROM users WHERE (UNIX_TIMESTAMP()-UNIX_TIMESTAMP(quand))<=3600*24";
		$result=mysql_query($query);
		$inc_users=mysql_result($result,0);

		$query="SELECT count(0) FROM comments";
		$result=mysql_query($query);
		$nb_comments=mysql_result($result,0);
		$query="SELECT count(0) FROM comments WHERE (UNIX_TIMESTAMP()-UNIX_TIMESTAMP(quand))<=3600*24";
		$result=mysql_query($query);
		$inc_comments=mysql_result($result,0);

		$fp = fopen("../include/stats.cache.inc", "wb");
		fwrite($fp, "\n");
		fclose($fp);
	}

//require('../include/misc.php'); cant use that include couz i need relative path of /include/


?>
options:
- all
- ojuice
- glops
- topdemos
- logos
- voteavg
- results
- cacheonelines
- cachelatestcomments
- cachetop_demos
- cachetop_keops
- cachelatest_demos
- cachestats
- cachecdclist
- allcaches
- webtv
");
}
?>
"); } require_once("../include/auth.php"); $dbinfo=$db; $db=mysql_connect($dbinfo['host'],$dbinfo['user'], $dbinfo['password']); mysql_select_db($dbinfo['database'],$db); if ($ojuice||$all) { for($i=0;$i<=4;$i++) { $query="REPLACE ojnews SET "; $query.="id=".$ojnews[$i]["id"].", "; $query.="title='".addslashes($ojnews[$i]["title"])."', "; $query.="url='".$ojnews[$i]["url"]."', "; $query.="quand='".$ojnews[$i]["when"]."', "; $query.="authorid=".$ojnews[$i]["authorid"].", "; $query.="authornick='".addslashes($ojnews[$i]["authornick"])."', "; $query.="authorgroup='".addslashes($ojnews[$i]["authorgroup"])."', "; $query.="content='".addslashes($ojnews[$i]["content"])."'"; mysql_query($query,$db); print("
".$query."
"); } print("ojuice stage 3!
"); } // calculate users's glops if ($glops||$all) { unset($logos); $result=mysql_query("SELECT id,file,vote_count FROM logos"); // WHERE author1=".$user["id"]." || author2=".$user["id"]); while($tmp=mysql_fetch_array($result)) { if ( ($tmp["author1"]) && ($tmp['vote_count'] > 0) ) $totals[$tmp["author1"]]+=20; if ( ($tmp["author2"]) && ($tmp['vote_count'] > 0) ) $totals[$tmp["author2"]]+=20; } $query="SELECT added FROM prods"; $result=mysql_query($query); while($tmp=mysql_fetch_assoc($result)) { $totals[$tmp["added"]]+=2; } $query="SELECT added FROM groups"; $result=mysql_query($query); while($tmp=mysql_fetch_assoc($result)) { $totals[$tmp["added"]]++; } $query="SELECT added FROM parties"; $result=mysql_query($query); while($tmp=mysql_fetch_assoc($result)) { $totals[$tmp["added"]]++; } $query="SELECT user FROM screenshots"; $result=mysql_query($query); while($tmp=mysql_fetch_assoc($result)) { $totals[$tmp["user"]]++; } $query="SELECT user FROM nfos"; $result=mysql_query($query); while($tmp=mysql_fetch_assoc($result)) { $totals[$tmp["user"]]++; } $query="SELECT adder FROM bbses"; $result=mysql_query($query); while($tmp=mysql_fetch_assoc($result)) { $totals[$tmp["adder"]]++; } $query="SELECT COUNT(DISTINCT which) as comments,who FROM comments GROUP BY who"; $result=mysql_query($query); while($tmp=mysql_fetch_assoc($result)) { $totals[$tmp["who"]]+=$tmp["comments"]; } $query="SELECT users.id,ud.points FROM users,ud WHERE ud.login=users.udlogin"; $result=mysql_query($query); while($tmp=mysql_fetch_assoc($result)) $totals[$tmp["id"]]+=round($tmp["points"]/1000); reset($totals); for($i=0;$i"); } if ($topdemos||$all) { // debut calcul top demos unset($total); $i=0; $query="SELECT id FROM prods ORDER BY views DESC"; $result = mysql_query($query); while($tmp = mysql_fetch_assoc($result)) { $total[$tmp["id"]]+=$i; $i++; } $i=0; $query="SELECT prods.id,SUM(comments.rating) AS somme FROM prods,comments WHERE prods.id=comments.which GROUP BY prods.id ORDER BY somme DESC"; $result = mysql_query($query); while($tmp = mysql_fetch_assoc($result)) { $total[$tmp["id"]]+=$i; $i++; } asort($total); $i=1; unset($tmp); unset($top_demos); while ((list ($key, $val)=each($total))) { $query="UPDATE prods SET rank=".$i." WHERE id=".$key; mysql_query($query); $i++; } $cachetop_keops=true; print("keops!
"); } if ($logos||$all) { //update logos vote_count $query="SELECT logos.id,SUM(logos_votes.vote) AS votes FROM logos,logos_votes WHERE logos_votes.logo=logos.id group by logos.id"; $result=mysql_query($query); while($tmp=mysql_fetch_array($result)) { $votes[]=$tmp; } for ($i=0;$i"); } //update vote info if ($voteavg||$all) { $query ="SELECT id FROM prods"; $result = mysql_query($query); while($tmp = mysql_fetch_array($result)) { $prods[]=$tmp; } print("updating ".count($prods)." prods
"); for($j=0;$j"); mysql_query($query); } print("voteavg!
"); } //update bbs info if ($bbstopics||$all) { $query ="SELECT id FROM bbs_topics"; $result = mysql_query($query); while($tmp = mysql_fetch_array($result)) { $topics[]=$tmp; } print("updating ".count($topics)." bbs_topics
"); for($i=0;$i"); mysql_query($query); } print("bbstopics!
"); } if ($cacheonelines||$all||$allcaches) { create_cache_module("onelines", "SELECT oneliner.who,oneliner.message,users.nickname,users.avatar FROM oneliner,users WHERE oneliner.who=users.id ORDER BY oneliner.quand DESC LIMIT 50",0); print("cache oneliner!
"); } if ($cachelatestcomments||$all||$allcaches) { create_cache_module("latest_comments", "SELECT prods.id,prods.name,prods.type,prods.group1,prods.group2,prods.group3,comments.who,users.nickname,users.avatar FROM prods JOIN comments LEFT JOIN users ON users.id=comments.who WHERE comments.which=prods.id ORDER BY comments.quand DESC LIMIT 50",1); print("cache latest comments!
"); } if ($cachetop_demos||$all||$allcaches) { create_cache_module("top_demos", "SELECT prods.id, prods.name,prods.type,prods.group1,prods.group2,prods.group3 FROM prods WHERE prods.quand > DATE_SUB(sysdate(),INTERVAL '30' DAY) AND prods.quand < DATE_SUB(sysdate(),INTERVAL '0' DAY) ORDER BY (prods.views/((sysdate()-prods.quand)/100000)+prods.views)*prods.voteavg*prods.voteup desc LIMIT 50",1); print("cache topdemos!
"); } if ($cachetop_keops||$all||$allcaches) { create_cache_module("top_keops", "SELECT prods.id,prods.name,prods.type,prods.group1,prods.group2,prods.group3 FROM prods WHERE prods.rank!=0 ORDER BY prods.rank ASC LIMIT 50",1); print("cache top keops!
"); } if ($cachecdclist||$all||$allcaches) { create_cache_module("cdclist", "SELECT distinct prods.id as which,count(prods.id) as count,prods.name,prods.type,prods.group1,prods.group2,prods.group3 FROM users WHERE (users.cdc=prods.id OR users.cdc2=prods.id OR users.cdc3=prods.id OR users.cdc4=prods.id OR users.cdc5=prods.id) group by prods.id order by count desc",1); print("cache cdc list!
"); } if ($cachelatest_demos||$all||$allcaches) { create_cache_module("latest_demos", "SELECT prods.id,prods.name,prods.type,prods.group1,prods.group2,prods.group3,prods.added,users.nickname,users.avatar FROM prods LEFT JOIN users ON users.id=prods.added ORDER BY prods.quand DESC LIMIT 50",1); create_cache_module("latest_released_prods", "SELECT prods.id,prods.name,prods.type,prods.group1,prods.group2,prods.group3 FROM prods ORDER BY prods.date DESC,prods.quand DESC LIMIT 50",1); create_cache_module("latest_released_parties", "select distinct parties.name, parties.id, prods.party_year, COUNT(prods.party) as prodcount from parties right join prods on prods.party=parties.id where parties.id!=1024 group by prods.party,prods.party_year order by prods.date desc, prods.id desc limit 50",0); print("cache latest demos!
"); print("cache latest released prods!
"); print("cache latest parties!
"); } if ($cachestats||$all||$allcaches) { create_stats_cache(); print("cache stats!
"); } if ($webtv||$all) { if ($fdtv = fopen("http://www.demoscene.tv/page.php?id=172&lang=uk&vsmaction=vod_list", "r")) { $contents = ''; while (!feof($fdtv)) { $contents .= fread($fdtv, 8192); } fclose($fdtv); $pstring = 'http://www.pouet.net/prod.php?which='; $dstring = 'http://www.demoscene.tv/prod.php?id_prod='; $pos = strpos($contents, $pstring); while ($pos != false) { $posend = strpos($contents, '"', $pos) - ($pos + strlen($pstring)); $pouetid = substr($contents, $pos + strlen($pstring), $posend); //echo "check: " . $posend . " ->" . $pouetid . "<-"; if ($pouetid != '') { $posid = strpos($contents, $dstring, $pos + $posend + strlen($dstring)); $posend = strpos($contents, '"', $posid) - ($posid + strlen($dstring)); $dtvid = substr($contents, $posid + strlen($dstring), $posend); //echo "p: " . $pouetid . " d: " . $dtvid . "
"; //check db, update if needed $query = "select prod from downloadlinks where type like 'demoscene.tv' and prod = " . $pouetid; $result = mysql_query($query); while($tmp = mysql_fetch_array($result)) { $prods[]=$tmp; } if (count($prods) == 0) { $query ="insert into downloadlinks set type = 'demoscene.tv', link = 'http://www.demoscene.tv/prod.php?id_prod=".$dtvid."', prod =". $pouetid; $result = mysql_query($query); echo "inserted, pouetid: " . $pouetid . " dtvid: " . $dtvid . "
"; } else { echo "already existed, pouetid: " . $pouetid . " dtvid: " . $dtvid . "
"; } unset($prods); } $pos = strpos($contents, $pstring, $pos + strlen($pstring)); } } print("
demoscene.tv done!
"); //load http://capped.tv/rss.php //parse all pouet ids //compare to cache, if diff check db info and insert if missing capped.tv link if ($fcapped = fopen("http://capped.tv/rss.php", "r")) { $contents = ''; while (!feof($fcapped)) { $contents .= fread($fcapped, 8192); } fclose($fcapped); $pstring = 'http://capped.tv/playeralt.php?vid='; $dstring = 'http://pouet.net/prod.php?which='; $pos = strpos($contents, $pstring); while ($pos != false) { $posend = strpos($contents, '', $pos) - ($pos + strlen($pstring)); $capped = substr($contents, $pos + strlen($pstring), $posend); $posid = strpos($contents, $dstring, $pos + $posend + strlen($dstring)); $posend = strpos($contents, '\'>Pouet', $posid) - ($posid + strlen($dstring)); $pouetid = substr($contents, $posid + strlen($dstring), $posend); //echo "p: " . $pouetid . " d: " . $dtvid . "
"; //check db, update if needed $query = "select prod from downloadlinks where type like 'capped.tv' and prod = " . $pouetid; $result = mysql_query($query); while($tmp = mysql_fetch_array($result)) { $prods[]=$tmp; } if (count($prods) == 0) { $query ="insert into downloadlinks set type = 'capped.tv', link = 'http://capped.tv/playeralt.php?vid=".$capped."', prod =". $pouetid; $result = mysql_query($query); echo "inserted, pouetid: " . $pouetid . " capped: " . $capped . "
"; } else { echo "already existed, pouetid: " . $pouetid . " capped: " . $capped . "
"; } unset($prods); $pos = strpos($contents, $pstring, $pos + strlen($pstring)); } } fclose($fcapped); print("
capped.tv done!
"); print("
webtv done!
"); } mysql_close($db); print("

aiiiiiiiiiiiii cookie
bolber a la vida loca
"); ?>