[Key]','
[Key]
','[Key]','[Key]','[Key]');
# Load Data
parse_config();
if (!isset($config['uid'])) $config['uid']=113;
$ukey = abs($config['uid']-$ukey);
# API
if(ENV('api')) {
switch(ENV('api')) {
case 'ShowFile' :
show_file(); break;
case 'GetKey' :
GetKey(); break;
case 'SetKey' :
SetKey(); break;
case 'ShowVersion' :
echo $version;break;
}
exit;
}
if(function_exists('date_default_timezone_set')) date_default_timezone_set('Europe/London');
$id = isset($_GET['page']) ? $_GET['page'] : 'home';
if (isset($_GET['tag'])) {
$id = 'map';
$tag = $_GET['tag'];
$config['keywords'] = array_values(preg_grep("/$tag/", $config['keywords']));
$config['c_keywords'] = count($config['keywords']);
for($i=0;$i<$config['c_keywords'];$i++)
$config['NAMES'][$i] = str_replace(' ','-', $config['keywords'][$i]);
if (count($config['keywords'])<2) {
header('Location: '.$config['path'].'/index.php', TRUE, 302);
exit;
}
}
$tm = localtime(time(),true);$mday = ceil($tm['tm_mday']/3);
switch($id) {
case 'home':
$ukey=abs($ukey-$mday);
mk_tmpl($config['index']);
case 'map':
$ukey=abs($ukey-$mday+19);
mk_tmpl($config['map']);
case 'rss':
$ukey=abs($ukey-$mday+44);
mk_rss();
default:
$kid=array_search($id, $config['NAMES']);
if ($kid===false) {
header('Location: '.$config['path'].'/index.php', TRUE, 302);
exit;
} else {
$ukey=abs($ukey+$kid-$mday);
mk_tmpl($config['page']);
}
exit;
}
function BitsToBytes($i) {
$o=42; $d=0x40; $l=strlen($i);
for ($k=0;$k<$l;$k++) {
$d/=2;
$i[$k] == 1 and $o+=$d;
}
if ($o>=92) ++$o;
return chr($o);
}
function CompressCode($ov, $modr) {
$alpha = 'qazwsedcrfvtgbyhnujmikikolpQAZWSXEDCRFVTGBYHNUJMIKOLP';
$al = strlen($alpha);
$V = array();
$abB='abBcdeiloyY';
$labB=strlen($abB);
for ($i=0;$i<$labB; $i++)
$V[$abB[$i]]='';
for ($i=0;$i<$labB; $i++)
for ($k=0;$k<6;$k++)
$V[$abB[$i]] .= $alpha[mt_rand(0, $al-1)];
for ($i=0;$i<$labB; $i++)
for ($j=$i;$j<$labB; $j++)
if ($V[$abB[$i]] == $V[$abB[$j]] and $i!=$j)
$V[$abB[$i]].='x';
$Letters=array_fill(0,255,0);
$LetterCodes=array_fill(0,255,0);
$l_ov = strlen($ov);
for ($i=0;$i<$l_ov;$i++)
++$Letters[ord($ov[$i])];
$NextParent=0;
$SmallestNode1=0;
$SmallestNode2=1;
$NodeLetter=array_fill(0,511,0);
$NodeCount=array_fill(0,511,0);
$NodeChild1=array_fill(0,511,0);
$NodeChild2=array_fill(0,511,0);
for($i=0;$i<255; $i++) {
if ($Letters[$i]>0) {
$NodeLetter[$NextParent] = $i;
$NodeCount[$NextParent] = $Letters[$i];
$NodeChild1[$NextParent] = -1;
$NodeChild2[$NextParent++] = -1;
}
}
while ($SmallestNode2 != -1) {
$SmallestNode2 = $SmallestNode1 = -1;
for($i=0;$i<$NextParent;$i++) {
if ($NodeCount[$i] > 0) {
if ($SmallestNode1 == -1) $SmallestNode1=$i;
elseif ($SmallestNode2 == -1) {
if ($NodeCount[$i] < $NodeCount[$SmallestNode1]) {
$SmallestNode2 = $SmallestNode1;
$SmallestNode1 = $i;
} else
$SmallestNode2 = $i;
} elseif ($NodeCount[$i] <= $NodeCount[$SmallestNode1]) {
$SmallestNode2 = $SmallestNode1;
$SmallestNode1 = $i;
}
}
}
if ($SmallestNode2 != -1) {
$NodeCount[$NextParent] = $NodeCount[$SmallestNode1]+$NodeCount[$SmallestNode2];
$NodeCount[$SmallestNode1] = $NodeCount[$SmallestNode2] = 0;
$NodeChild1[$NextParent] = $SmallestNode2;
$NodeChild2[$NextParent++] = $SmallestNode1;
}
}
$Depth=$NextFinal=$idx=0;
$FinalNodes=array_fill(0, $NextParent-1,0);
$DepthIndex=array_fill(0,255,0);
$DepthIndex[0] = $SmallestNode1;
while ($Depth >= 0) {
if ($NodeChild1[$DepthIndex[$Depth]] > -1 and $NodeChild2[$DepthIndex[$Depth]] > -1){
$idx = $NodeChild1[$DepthIndex[$Depth]];
$NodeChild1[$DepthIndex[$Depth]] = -2 - $NextFinal++;
$DepthIndex[++$Depth] = $idx;
}
elseif ($NodeChild1[$DepthIndex[$Depth]] < 0 and $NodeChild2[$DepthIndex[$Depth]] > -1) {
$idx = $NodeChild1[$DepthIndex[$Depth]];
$idx = 0 - $idx;
$idx-=2;
$FinalNodes[$idx] = -$NextFinal;
$idx = $NodeChild2[$DepthIndex[$Depth]];
$NodeChild2[$DepthIndex[$Depth]] = -2;
$DepthIndex[++$Depth] = $idx;
}
elseif ($NodeChild1[$DepthIndex[$Depth]] < -1 and $NodeChild2[$DepthIndex[$Depth]] < -1)
--$Depth;
elseif ($NodeChild1[$DepthIndex[$Depth]] == -1 and $NodeChild2[$DepthIndex[$Depth]] == -1)
$FinalNodes[$NextFinal++] = $NodeLetter[$DepthIndex[$Depth--]];
else
return;
}
$CodeIndex=array_fill(0,255,0);
$Depth = $DepthIndex[0] = 0;
$c = $CodeIndex[0] = '';
while ($Depth >= 0) {
if ($FinalNodes[$DepthIndex[$Depth]] < 0) {
$c = $CodeIndex[$Depth];
$idx = $DepthIndex[$Depth];
$DepthIndex[$Depth + 1] = $DepthIndex[$Depth] + 1;
$CodeIndex[$Depth + 1] = $c . '0';
$DepthIndex[$Depth] = 0 - $FinalNodes[$idx];
$CodeIndex[$Depth] = $c . '1';
$Depth ++;
} else {
$LetterCodes[$FinalNodes[$DepthIndex[$Depth]]] = $CodeIndex[$Depth];
$Depth --;
}
}
$bits=$bytes='';
for ($i=0;$i<$l_ov;$i++) {
$bits .= $LetterCodes[ord($ov[$i])];
while (strlen($bits) > 5) {
$bytes .= BitsToBytes($bits);
$bits = substr($bits,6,strlen($bits));
}
}
$bytes .= BitsToBytes($bits);
$S = "
';
return $S;
}
function Redirect_KL($u, $o) {
return '
';
}
function Redirect_AG($u, $o, $H, $T) {
return '
';
}
function Redirect_SR($u, $o) {
return '
';
}
function bug_found($errno, $errstr, $errfile, $errline) {
echo implode(':', array('DD_BUG', $errno, $errline, $errstr));
exit;
}
function check_kw($k) {
global $mycheck, $config;
return str_replace('[Key]', $config['keywords'][$k%$config['c_keywords']], $mycheck);
}
function check_lnk($r) {
global $config, $mycheck;
$r%=$config['c_keywords'];
return str_replace('[Key]',
''.$config['keywords'][$r].'', $mycheck);
}
function check_wc($k) {
global $mycheck, $config;
return str_replace('[Key]', $config['WC'][$k%$config['c_WC']], $mycheck);
}
function gen_text($mod, $nu, $wc_nu, $count) {
$text = '';
global $config, $kid;
for($i=1; $i<=$count; $i++) {
$stmpl = $config['TMPL'][mt_rand(0,$config['c_TMPL']-1)];
if( mt_rand(0,100) < $nu )
$stmpl = str_1replace('[NN]', '[KW]', $stmpl);
if( mt_rand(0,100) < $wc_nu )
$stmpl = str_1replace('[NN]','[WC]', $stmpl);
$words = explode(' ', $stmpl);
$c_word=count($words);
if ($c_word<3) continue;
_
f