[Phpsysinfo-subversion] SF.net SVN: phpsysinfo:[240] js.php
Brought to you by:
namiltd
From: <big...@us...> - 2009-06-08 07:16:51
|
Revision: 240 http://phpsysinfo.svn.sourceforge.net/phpsysinfo/?rev=240&view=rev Author: bigmichi1 Date: 2009-06-08 07:16:41 +0000 (Mon, 08 Jun 2009) Log Message: ----------- allow debugging of js code by not compressing js when PSI_DEBUG = true Modified Paths: -------------- js.php Modified: js.php =================================================================== --- js.php 2009-06-08 07:15:31 UTC (rev 239) +++ js.php 2009-06-08 07:16:41 UTC (rev 240) @@ -1,4 +1,4 @@ -<?php +<?php /** * compress js files and send them to the browser on the fly * @@ -17,28 +17,33 @@ * * @var string */ -define('APP_ROOT', dirname(( __FILE__ ))); +define('APP_ROOT', dirname(__FILE__)); require_once APP_ROOT.'/includes/autoloader.inc.php'; +require_once APP_ROOT.'/config.php'; -$filepath = APP_ROOT.'/js/'; - -if ( isset ($_GET['name'])) { +if (isset($_GET['name'])) { $file = basename(htmlspecialchars($_GET['name'])); - if (strtolower(substr($file, 0, 6)) == 'jquery' && ! isset ($_GET['plugin'])) { - $filepath .= 'jQuery/'; + $filepath = APP_ROOT; + if (strtolower(substr($file, 0, 6)) == 'jquery' && !isset($_GET['plugin'])) { + $filepath = APP_ROOT.'/js/jQuery/'; } else { - if ( isset ($_GET['plugin'])) { + if (isset($_GET['plugin'])) { $filepath = APP_ROOT.'/plugins/'.basename(htmlspecialchars($_GET['plugin'])).'/js/'; } else { - $filepath .= 'phpSysInfo/'; + $filepath = APP_ROOT.'/js/phpSysInfo/'; } } $script = $filepath.$file.'.js'; - if (file_exists($script)) { - $packer = new JavaScriptPacker(file_get_contents($script)); + if (file_exists($script) && is_readable($script)) { + $filecontent = file_get_contents($script); header("content-type: application/x-javascript"); - echo $packer->pack(); + if (defined("PSI_DEBUG") && PSI_DEBUG === true) { + echo $filecontent; + } else { + $packer = new JavaScriptPacker($filecontent); + echo $packer->pack(); + } } } ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |