function reload() { $cls = $this->getArg(1); $clsFile = ZIGGI_SRC_PATH."$cls.class.php"; if(!file_exists($clsFile)) { $this->pm("class file $cls.class.php not found."); return; } $code = file_get_contents($clsFile); do { $tmpName = "z".substr(uniqid(),-8); } while( class_exists($tmpName) ); $newCode = ( str_replace("class $cls", "class $tmpName", str_replace("function $cls", "function $tmpName" , $code) ) ); $tmp = "/tmp/bz_swap.php"; $F=fopen($tmp,'w'); fwrite( $F, $newCode); fclose($F); $check = `php -l $tmp`; $ok = 'No syntax errors detected'; if(substr($check,0,strlen($ok)) != $ok) { $this->pm("new class file contains parse errors."); return; } include($tmp); $C = new $tmpName(); unlink($tmp); global $botzilla; $C->setAccessLevel(BZUSER_DEFAULT) $botzilla->ziggis[$cls] = $C; $this->pm("$cls reloaded"); }