kenken999/php
0
1<?php2require "include/phpfunctions.php";3 4$cCharset = "##@BUILDER.strCharset s##";5 6$queryString = getQueryString();7 8if (!isset($queryString) || strlen($queryString) == 0) {9 return;10}11$yuiFiles = explode("&", $queryString);12$contentType = strpos($yuiFiles[0], ".js") ? 'application/x-javascript' : ' text/css';13 14 15$yuiComponents = array();16 17if($contentType=='application/x-javascript')18{19 foreach($yuiFiles as $yuiFile) {20 $parts = explode("/", $yuiFile);21 if(count($parts) == 4)22 {23 if (isset($parts[0]) && isset($parts[1]) && isset($parts[2])) {24 //Add module to array for loading25 $yuiComponents[] = $parts[2]."/".$parts[2];26 } else {27 die('<!-- Unable to determine module name! '.runner_htmlspecialchars($yuiFile).' -->');28 }29 }30 else31 {32 $start = strpos($yuiFile, "/build/");33 if($start === FALSE)34 die('<!-- Unable to determine module name! '.runner_htmlspecialchars($yuiFile).' -->');35 $start += strlen("/build/");36 $end = strpos($yuiFile, ".js");37 if($end === FALSE)38 die('<!-- Unable to determine module name! '.runner_htmlspecialchars($yuiFile).' -->');39 $yuiComponents[] = substr($yuiFile, $start, $end - $start);40 }41 }42 $library = myfile_get_contents(getabspath("include/yui/yui.lib"), "r");43}44else45{46// css47 foreach($yuiFiles as $yuiFile) {48 $start = strpos($yuiFile, "/build/");49 if($start === FALSE)50 die('<!-- Unable to determine module name! '.runner_htmlspecialchars($yuiFile).' -->');51 $start += strlen("/build/");52 $yuiComponents[] = substr($yuiFile, $start);53 }54 $library = myfile_get_contents(getabspath("include/yui/yuicss.lib"), "r");55}56 57header("Cache-Control: max-age=315360000");58header("Expires: Thu, 29 Oct 2020 20:00:00 GMT");59header("Content-Type: " . $contentType);60 61foreach($yuiComponents as $y)62{63 $start = strpos($library, "begincombofile ".$y);64 if($start === FALSE)65 {66 die("Unknown file ".runner_htmlspecialchars($y));67 }68 $start += strlen("begincombofile ".$y);69 $end = strpos($library, "endcombofile", $start);70 if($end === FALSE)71 {72 die("Unknown file ".runner_htmlspecialchars($y));73 }74 echo substr($library, $start, $end - $start);75}76?>