fetch_page("templates/glitchdex2template"); $page = $page['body'];//$templates[glitchdex2template]; $bits = explode(":",$glitch[designation]); $glitch[version] = $realCats[$shortnames[$bits[0]]]; $glitch[dec] = intval($bits[1]); //list($legacyname) = mysql_fetch_array(mysql_query("SELECT `iname` FROM `glitchdex` WHERE `dec`='$glitch[dec]' AND `cat`='{$shortnames[$bits[0]]}'")); $legacyname = $glitch[old_iname]; $glitch[hex] = strtoupper(dechex($glitch[dec])); // evolution $evolution = unserialize($glitch[evolution]); if($evolution[0][1] == "None") { $glitch[evolve] = ""; } else { $glitch[evolve] = ''; $twidth = intval(100 / count($evolution)); if(is_array($evolution)) foreach($evolution As $ev) $glitch[evolve] .= ""; $glitch[evolve] .= '
$ev[1]
$ev[0]
'; } // imagery $glitch[sprite] = ""; $glitch[realname] = name(array("cat" => $shortnames[$bits[0]], "iname" => $legacyname, "name" => $glitch[name])); $glitch[icon] = icon(array("cat" => $shortnames[$bits[0]], "iname" => $legacyname)); //print_r($glitch); // stats $glitch[hp50] = getHp($glitch[hp],50); $glitch[hp100] = getHp($glitch[hp],100); $glitch[hp255] = getHp($glitch[hp],255); $glitch[attack50] = getStat($glitch[attack],50); $glitch[attack100] = getStat($glitch[attack],100); $glitch[attack255] = getStat($glitch[attack],255); $glitch[defense50] = getStat($glitch[defense],50); $glitch[defense100] = getStat($glitch[defense],100); $glitch[defense255] = getStat($glitch[defense],255); $glitch[speed50] = getStat($glitch[speed],50); $glitch[speed100] = getStat($glitch[speed],100); $glitch[speed255] = getStat($glitch[speed],255); $glitch[spatk50] = getStat($glitch[spatk],50); $glitch[spatk100] = getStat($glitch[spatk],100); $glitch[spatk255] = getStat($glitch[spatk],255); $glitch[spdef50] = getStat($glitch[spdef],50); $glitch[spdef100] = getStat($glitch[spdef],100); $glitch[spdef255] = getStat($glitch[spdef],255); // attacks templates $atemp = substr($page,strpos($page, "") + 6); $atemp = substr($atemp,0,strpos($atemp,"")); $page = str_replace("$atemp","",$page); $attax = ""; $glitch[learned] = unserialize($glitch[learned]); if(is_array($glitch[learned])) { foreach($glitch[learned] As $attack) { $attax .= str_replace(array("{level}","{movename}"),$attack,$atemp); } } $page = str_replace("",$attax,$page); $ttemp = substr($page,strpos($page, "") + 6); $ttemp = substr($ttemp,0,strpos($ttemp,"")); $page = str_replace("$ttemp","",$page); $tmattax = ""; $glitch[tmhm] = unserialize($glitch[tmhm]); if(is_array($glitch[tmhm])) { foreach($glitch[tmhm] As $attack) { $tmattax .= str_replace(array("{tm}","{movename}"),$attack,$ttemp); } } $page = str_replace("",$tmattax,$page); $glitch[cry] = ""; // prep the template foreach($glitch As $attr => $val) { $page = str_replace("{".$attr."}",trim($val),$page); } return $page; } $shortnames = array( "RB" => "redblue", "Y" => "yellow", "G" => "green", "GSC" => "goldsilvercrystal", "RSE" => "rubysapphire", "DP" => "diamondpearl" ); $shorthand = array_flip($shortnames); $realCats = array( "redblue" => "Red/Blue", "yellow" => "Yellow", "green" => "Green", "goldsilvercrystal" => "Gold/Silver/Crystal", "rubysapphire" => "Ruby/Sapphire", "diamondpearl" => "Diamond/Pearl", "tcg" => "TCG", ); session_name('s'); session_start(); // first: include building blocks include("include/kayla.php"); include("include/settings.php"); //$kayla->init(); include("backup/scripts/buildblocks.php"); // get directive information $directive = getDirectives($_SERVER[PATH_INFO]); $usenomenclature = false; global $shortnames,$shorthand; if(strpos($directive[1],":")) { $glitch = mysql_fetch_array(mysql_query("SELECT * FROM `glitchdex2` WHERE `designation` LIKE '%{$directive[1]}%' LIMIT 1")); $kayla->output( array( "body"=>page($glitch), "name"=>"Data for: ".$glitch['designation'], "dynamic"=>0, "use_container"=>1 ), false ); } else { $list_template = $kayla->fetch_page("templates/glitchdex/list"); $kayla->output($list_template); } function name($row) { $path = "dexdata/$row[cat]/$row[iname]/name.png"; $path2 = "dexdata/$row[cat]/$row[iname]/name.PNG"; //echo $path; if(file_exists(SITE_ROOT."/".$path)) return "\"$row[name]\"";//echo "b"; if(file_exists(SITE_ROOT."/".$path2)) return "\"$row[name]\"";//echo "b"; return $row[name]; } function icon($row) { $path = "dexdata/$row[cat]/$row[iname]/icon.gif"; $path2 = "dexdata/$row[cat]/$row[iname]/icon.GIF"; if(file_exists(SITE_ROOT."/".$path)) return "  "; if(file_exists(SITE_ROOT."/".$path2)) return "  "; $path = "dexdata/$row[cat]/$row[iname]/icon.png"; $path2 = "dexdata/$row[cat]/$row[iname]/icon.PNG"; if(file_exists(SITE_ROOT."/".$path)) return "  "; if(file_exists(SITE_ROOT."/".$path2)) return "  "; return ""; } ?>