Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /** * CheckBomCommand * * Checks for BOM files in a directory. If --fix provided,..
Decoded Output download
<?php
/**
* CheckBomCommand
*
* Checks for BOM files in a directory. If --fix provided, removes BOM where found.
* Use --path=my/path to run on non-framework directory.
*
* @author Alex Makarov <[email protected]>
* @package system.build
* @since 1.1.9
*/
class CheckBomCommand extends CConsoleCommand
{
const BOM="";
public function actionIndex($path=null,$fix=null)
{
if($path===null)
$path=YII_PATH;
echo "Checking $path for files with BOM.
";
$checkFiles=CFileHelper::findFiles($path,array(
'exclude'=>array(
'.gitignore',
),
));
$detected=false;
foreach($checkFiles as $file)
{
$fileObj=new SplFileObject($file);
if(!$fileObj->eof() && false!==strpos($fileObj->fgets(),self::BOM))
{
if(!$detected)
{
echo "Detected BOM in:
";
$detected=true;
}
echo $file."
";
if($fix)
{
file_put_contents($file, substr(file_get_contents($file), 3));
}
}
}
if(!$detected)
{
echo "No files with BOM were detected.
";
}
else if($fix)
{
echo "All files were fixed.
";
}
}
}
?>
Did this file decode correctly?
Original Code
<?php
/**
* CheckBomCommand
*
* Checks for BOM files in a directory. If --fix provided, removes BOM where found.
* Use --path=my/path to run on non-framework directory.
*
* @author Alex Makarov <[email protected]>
* @package system.build
* @since 1.1.9
*/
class CheckBomCommand extends CConsoleCommand
{
const BOM="\xEF\xBB\xBF";
public function actionIndex($path=null,$fix=null)
{
if($path===null)
$path=YII_PATH;
echo "Checking $path for files with BOM.\n";
$checkFiles=CFileHelper::findFiles($path,array(
'exclude'=>array(
'.gitignore',
),
));
$detected=false;
foreach($checkFiles as $file)
{
$fileObj=new SplFileObject($file);
if(!$fileObj->eof() && false!==strpos($fileObj->fgets(),self::BOM))
{
if(!$detected)
{
echo "Detected BOM in:\n";
$detected=true;
}
echo $file."\n";
if($fix)
{
file_put_contents($file, substr(file_get_contents($file), 3));
}
}
}
if(!$detected)
{
echo "No files with BOM were detected.\n";
}
else if($fix)
{
echo "All files were fixed.\n";
}
}
}
Function Calls
None |
Stats
MD5 | 45937b2c7f299ba6a87d9d53623a171c |
Eval Count | 0 |
Decode Time | 86 ms |