被这个插件害死额

joomla之门里面介绍的这个…哎~害死人!叫什么contentstatic[code]<?php

// no direct access
defined( ‘_JEXEC’ ) or die( ‘Restricted access’ );
define( ‘DS’, DIRECTORY_SEPARATOR );
jimport( ‘joomla.plugin.plugin’ );

class plgSystemContentstatic extends JPlugin
{

function plgSystemContentstatic(& $subject, $config)
{
	parent::__construct($subject, $config);

}


function onAfterRender()
{
	global $mainframe;

	if($mainframe->isAdmin()) {
		return;
	}
	$document	=& JFactory::getDocument();
	$doctype	= $document->getType();

	// Only render for HTML output
	if ( $doctype != 'html' ) { return; }
  // Only render for articles
  if ((JRequest :: getVar('view')) != 'article'){ return;}
  $body = JResponse::getBody();
  //$base_dir=JPATH_BASE;
  $base_dir=$this->param('Joomla_base_dir');//"/var/www";

  if($base_dir==''){
    $base_dir=JPATH_BASE;
  }
        
  
  $relativePath=$this->request_uri();
  
  $relativePath=str_replace('/',DS,$relativePath);
  
  $fullPath=$base_dir.$relativePath;
  $parts=explode(DS,$relativePath);
  
  $currentPath=$base_dir.DS;
//  echo($fullPath);

   foreach( $parts as $p){		   			
  // echo($p.'<br>');
     if($p==''){
        continue;
     }
     $currentPath.=$p;
     if($currentPath==$fullPath){
         if(!file_exists($fullPath)){	           
          $this->writeToFile($fullPath,$body);
        }       
     }else{	 

      if(!file_exists($currentPath)||is_file($currentPath)){
         mkdir($currentPath);
       }	
 
     if(($currentPath!=JPATH_BASE)&&($currentPath!=$base_dir)){
       $indexFile=$currentPath.DS.'index.html';
	    if(!file_exists($indexFile)){
	        $this->writeToFile($indexFile,$this->indexContent());	          
	    }
	    }
     $currentPath.=DS;
	 
     }
      
    
 	     
   }//end for each
 
}

function writeToFile($fileName,$content){
   $handle=fopen($fileName,'w');
   fwrite($handle,$content);
   fclose($handle);	
}

function indexContent(){
 return "<html><body bgcolor='#FFFFFF'></body></html>";	
}


function request_uri(){
	if (isset($_SERVER['REQUEST_URI'])){
	   $uri = $_SERVER['REQUEST_URI'];
	}else{
	  if (isset($_SERVER['argv'])){
	    $uri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['argv'][0];
	  }else{
	     $uri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING'];
	  }
	}	
	return $uri;

} 

function param($name){
static $plugin,$pluginParams;
if (!isset( $plugin )){
$plugin =& JPluginHelper::getPlugin(‘system’, ‘contentstatic’);
$pluginParams = new JParameter( $plugin->params );
}
return $pluginParams->get($name);
}

}[/code]